From f6f8225390c8b9b15fcc53f6736b09a7e4aeefca Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 30 Nov 2011 18:02:24 +0100 Subject: [PATCH] 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. --- src/proto_tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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