Cygwin: Fix racy read to detect applications sockets close
authorChristian Babeux <christian.babeux@efficios.com>
Thu, 6 Dec 2012 04:33:17 +0000 (23:33 -0500)
committerChristian Babeux <christian.babeux@efficios.com>
Fri, 7 Dec 2012 20:17:55 +0000 (15:17 -0500)
commitbcccc1bfd7e1586259ff1c516a458e04321d0e78
treec90b50f3adb7277087c330170980dce99c9fea36
parent268ec049968538c7a3176159fc992b07ebe69af1
Cygwin: Fix racy read to detect applications sockets close

The mechanism to detect the applications sockets close is racy and
could potentially discard data. A read(3) is performed on the application
socket and the returned len is compared to 0 to detect the case where an
application closed the socket. If a read(3) occur in the thread_manage_apps
*before* the consumption of the data in the consumer, one byte of data would
be discarded.

To fix this race, perform a recv(3) on the socket with the MSG_PEEK flag.
This has no impact on the data delivery to the consumer and can successfully
detect the applications sockets close.
src/bin/lttng-sessiond/main.c
This page took 0.024496 seconds and 4 git commands to generate.