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.
This commit is contained in:
Willy Tarreau 2023-01-12 19:37:07 +01:00
parent 7dbd4187dc
commit cfb7c2f515
3 changed files with 5 additions and 5 deletions

View File

@ -92,7 +92,7 @@ enum li_status {
/* 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 @@ enum li_status {
#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 */

View File

@ -4288,6 +4288,8 @@ int check_config_validity()
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 @@ int check_config_validity()
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) {

View File

@ -605,7 +605,7 @@ int tcp_bind_listener(struct listener *listener, char *errmsg, int errlen)
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;