From: Willy Tarreau Date: Wed, 30 Nov 2011 17:02:24 +0000 (+0100) Subject: BUG: tcp: option nolinger does not work on backends X-Git-Tag: v1.5-dev8~73 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f6f8225390c8b9b15fcc53f6736b09a7e4aeefca;p=thirdparty%2Fhaproxy.git BUG: tcp: option nolinger does not work on backends Daniel Rankov reported that "option nolinger" is inefficient on backends. The reason is that it is set on the file descriptor only, which does not prevent haproxy from performing a clean shutdown() before closing. We must set the flag on the stream_interface instead if we want an RST to be emitted upon active close. --- diff --git a/src/proto_tcp.c b/src/proto_tcp.c index e5496dc024..ecef63f85b 100644 --- a/src/proto_tcp.c +++ b/src/proto_tcp.c @@ -267,7 +267,7 @@ int tcp_connect_server(struct stream_interface *si) setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &one, sizeof(one)); if (be->options & PR_O_TCP_NOLING) - setsockopt(fd, SOL_SOCKET, SO_LINGER, &nolinger, sizeof(struct linger)); + si->flags |= SI_FL_NOLINGER; /* allow specific binding : * - server-specific at first