mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-09 16:47:18 +02:00
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:
parent
7dbd4187dc
commit
cfb7c2f515
@ -92,7 +92,7 @@ enum li_status {
|
|||||||
|
|
||||||
/* listener socket options */
|
/* listener socket options */
|
||||||
#define LI_O_NONE 0x0000
|
#define LI_O_NONE 0x0000
|
||||||
#define LI_O_NOLINGER 0x0001 /* disable linger on this socket */
|
/* unused 0x0001 */
|
||||||
/* unused 0x0002 */
|
/* unused 0x0002 */
|
||||||
#define LI_O_NOQUICKACK 0x0004 /* disable quick ack of immediate data (linux) */
|
#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 */
|
#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_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_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_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 */
|
/* flags used with bind_conf->ssl_options */
|
||||||
|
@ -4288,6 +4288,8 @@ int check_config_validity()
|
|||||||
if (!bind_conf->maxaccept)
|
if (!bind_conf->maxaccept)
|
||||||
bind_conf->maxaccept = global.tune.maxaccept ? global.tune.maxaccept : MAX_ACCEPT;
|
bind_conf->maxaccept = global.tune.maxaccept ? global.tune.maxaccept : MAX_ACCEPT;
|
||||||
bind_conf->accept = session_accept_fd;
|
bind_conf->accept = session_accept_fd;
|
||||||
|
if (curproxy->options & PR_O_TCP_NOLING)
|
||||||
|
bind_conf->options |= BC_O_NOLINGER;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* adjust this proxy's listeners */
|
/* adjust this proxy's listeners */
|
||||||
@ -4310,9 +4312,6 @@ int check_config_validity()
|
|||||||
memprintf(&listener->name, "sock-%d", listener->luid);
|
memprintf(&listener->name, "sock-%d", listener->luid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (curproxy->options & PR_O_TCP_NOLING)
|
|
||||||
listener->options |= LI_O_NOLINGER;
|
|
||||||
|
|
||||||
#ifdef USE_QUIC
|
#ifdef USE_QUIC
|
||||||
if (listener->flags & LI_F_QUIC_LISTENER) {
|
if (listener->flags & LI_F_QUIC_LISTENER) {
|
||||||
if (!global.cluster_secret) {
|
if (!global.cluster_secret) {
|
||||||
|
@ -605,7 +605,7 @@ int tcp_bind_listener(struct listener *listener, char *errmsg, int errlen)
|
|||||||
|
|
||||||
fd = listener->rx.fd;
|
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));
|
setsockopt(fd, SOL_SOCKET, SO_LINGER, &nolinger, sizeof(struct linger));
|
||||||
else {
|
else {
|
||||||
struct linger tmplinger;
|
struct linger tmplinger;
|
||||||
|
Loading…
Reference in New Issue
Block a user