On Mon, Mar 30, 2009 at 3:00 PM, Ruediger Pluem <[email protected]> wrote:
> Does anybody know if the below comment from connection.c is still true? > > * In an ideal world, this function would be accomplished by simply > * setting the socket option SO_LINGER and handling it within the > * server's TCP stack while the process continues on to the next request. > * Unfortunately, it seems that most (if not all) operating systems > * block the server process on close() when SO_LINGER is used. > * For those that don't, see USE_SO_LINGER below. For the rest, > * we have created a home-brew lingering_close. (from 1.3) The premise seems questionable. The part about "block the server process on close() when SO_LINGER is used" ignores the fact that 1.3 on Unix had blocking sockets (timeouts were handled by the parent sending SIGALRM), so close with SO_LINGER was supposed to block. And I don't see code in 1.3 to set non-blocking when USE_SO_LINGER is defined. Section 7.5 of Stevens' UNPv1 (2e) covers SO_LINGER and the sort of logic we have in its place, but unfortunately doesn't describe SO_LINGER behavior for non-blocking sockets.
