MEDIUM: connection: centralize handling of nolinger in fd management
authorWilly Tarreau <w@1wt.eu>
Sun, 15 Dec 2013 13:19:38 +0000 (14:19 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 16 Dec 2013 01:23:52 +0000 (02:23 +0100)
commitad38acedaa7b5bd0f6c2f4d5816b331f35b7d07e
tree5abc291852c505833d7fa5524ec98200760c9628
parentd02cdd23be5f742408082bb04d4a387ee3b3b473
MEDIUM: connection: centralize handling of nolinger in fd management

Right now we see many places doing their own setsockopt(SO_LINGER).
Better only do it just before the close() in fd_delete(). For this
we add a new flag on the file descriptor, indicating if it's safe or
not to linger. If not (eg: after a connect()), then the setsockopt()
call is automatically performed before a close().

The flag automatically turns to safe when receiving a read0.
include/proto/connection.h
include/proto/fd.h
include/types/fd.h
src/checks.c
src/fd.c
src/frontend.c
src/proto_tcp.c
src/stream_interface.c