MINOR: listener: move the NOLINGER option to the bind_conf
It's currently declared per-frontend, though it would make sense to
support it per-line but in no case per-listener. Let's move the option
to a bind_conf option BC_O_NOLINGER.
diff --git a/include/haproxy/listener-t.h b/include/haproxy/listener-t.h
index 33d7541..8322ef4 100644
--- a/include/haproxy/listener-t.h
+++ b/include/haproxy/listener-t.h
@@ -92,7 +92,7 @@
/* listener socket options */
#define LI_O_NONE 0x0000
-#define LI_O_NOLINGER 0x0001 /* disable linger on this socket */
+/* unused 0x0001 */
/* unused 0x0002 */
#define LI_O_NOQUICKACK 0x0004 /* disable quick ack of immediate data (linux) */
#define LI_O_DEF_ACCEPT 0x0008 /* wait up to 1 second for data before accepting */
@@ -121,6 +121,7 @@
#define BC_O_USE_SOCK_STREAM 0x00000010 /* at least one stream-type listener is used */
#define BC_O_USE_XPRT_DGRAM 0x00000020 /* at least one dgram-only xprt listener is used */
#define BC_O_USE_XPRT_STREAM 0x00000040 /* at least one stream-only xprt listener is used */
+#define BC_O_NOLINGER 0x00000080 /* disable lingering on these listeners */
/* flags used with bind_conf->ssl_options */
diff --git a/src/cfgparse.c b/src/cfgparse.c
index 666d5c3..6b0a1e5 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -4288,6 +4288,8 @@
if (!bind_conf->maxaccept)
bind_conf->maxaccept = global.tune.maxaccept ? global.tune.maxaccept : MAX_ACCEPT;
bind_conf->accept = session_accept_fd;
+ if (curproxy->options & PR_O_TCP_NOLING)
+ bind_conf->options |= BC_O_NOLINGER;
}
/* adjust this proxy's listeners */
@@ -4310,9 +4312,6 @@
memprintf(&listener->name, "sock-%d", listener->luid);
}
- if (curproxy->options & PR_O_TCP_NOLING)
- listener->options |= LI_O_NOLINGER;
-
#ifdef USE_QUIC
if (listener->flags & LI_F_QUIC_LISTENER) {
if (!global.cluster_secret) {
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index dca1f8d..30135cc 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -605,7 +605,7 @@
fd = listener->rx.fd;
- if (listener->options & LI_O_NOLINGER)
+ if (listener->bind_conf->options & BC_O_NOLINGER)
setsockopt(fd, SOL_SOCKET, SO_LINGER, &nolinger, sizeof(struct linger));
else {
struct linger tmplinger;