]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG: tcp: option nolinger does not work on backends
authorWilly Tarreau <w@1wt.eu>
Wed, 30 Nov 2011 17:02:24 +0000 (18:02 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 30 Nov 2011 17:06:23 +0000 (18:06 +0100)
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.

src/proto_tcp.c

index e5496dc0243f82a38b4b8dfcc2c266b3de0f9fd9..ecef63f85b7100abfac452085a2f6bdbd31bb111 100644 (file)
@@ -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