diff --git a/include/haproxy/listener-t.h b/include/haproxy/listener-t.h index 15328f479..2181c811f 100644 --- a/include/haproxy/listener-t.h +++ b/include/haproxy/listener-t.h @@ -97,8 +97,8 @@ enum li_state { /* unused 0x0400 */ /* unused 0x0800 */ #define LI_O_ACC_CIP 0x1000 /* find the proxied address in the NetScaler Client IP header */ -/* unused 0x2000 */ -#define LI_O_MWORKER 0x4000 /* keep the FD open in the master but close it in the children */ +/* unused 0x2000 */ +/* unused 0x4000 */ #define LI_O_NOSTOP 0x8000 /* keep the listener active even after a soft stop */ /* Note: if a listener uses LI_O_UNLIMITED, it is highly recommended that it adds its own diff --git a/include/haproxy/receiver-t.h b/include/haproxy/receiver-t.h index 7bf15fb34..6f267ba12 100644 --- a/include/haproxy/receiver-t.h +++ b/include/haproxy/receiver-t.h @@ -29,9 +29,10 @@ #include #include -/* Bit values for receiver->options */ +/* Bit values for receiver->flags */ #define RX_F_BOUND 0x00000001 /* receiver already bound */ #define RX_F_INHERITED 0x00000002 /* inherited FD from the parent process (fd@) */ +#define RX_F_MWORKER 0x00000004 /* keep the FD open in the master but close it in the children */ /* Bit values for rx_settings->options */ #define RX_O_FOREIGN 0x00000001 /* receives on foreign addresses */ diff --git a/src/cli.c b/src/cli.c index 90320c2e9..7f4ea328a 100644 --- a/src/cli.c +++ b/src/cli.c @@ -2601,7 +2601,8 @@ int mworker_cli_proxy_new_listener(char *line) l->accept = session_accept_fd; l->default_target = mworker_proxy->default_target; /* don't make the peers subject to global limits and don't close it in the master */ - l->options |= (LI_O_UNLIMITED|LI_O_MWORKER); /* we are keeping this FD in the master */ + l->options |= LI_O_UNLIMITED; + l->rx.flags |= RX_F_MWORKER; /* we are keeping this FD in the master */ l->nice = -64; /* we want to boost priority for local stats */ global.maxsock++; /* for the listening socket */ } diff --git a/src/listener.c b/src/listener.c index 94db9579e..d28b8da4b 100644 --- a/src/listener.c +++ b/src/listener.c @@ -287,10 +287,8 @@ void enable_listener(struct listener *listener) * the workers. Conversely, if it's supposed to be only in the workers * close it in the master. */ - if ((master && !(listener->options & LI_O_MWORKER)) || - (!master && (listener->options & LI_O_MWORKER))) { + if (!!master != !!(listener->rx.flags & RX_F_MWORKER)) do_unbind_listener(listener); - } if (listener->state == LI_LISTEN) { BUG_ON(listener->rx.fd == -1); @@ -579,12 +577,12 @@ void do_unbind_listener(struct listener *listener) */ if (!stopping && !master && - !(listener->options & LI_O_MWORKER) && + !(listener->rx.flags & RX_F_MWORKER) && (global.tune.options & GTUNE_SOCKET_TRANSFER)) return; if (!stopping && master && - listener->options & LI_O_MWORKER && + listener->rx.flags & RX_F_MWORKER && listener->rx.flags & RX_F_INHERITED) return; diff --git a/src/mworker.c b/src/mworker.c index f3147a18b..d45b35795 100644 --- a/src/mworker.c +++ b/src/mworker.c @@ -422,7 +422,7 @@ void mworker_cleanlisteners() list_for_each_entry_safe(l, l_next, &curproxy->conf.listeners, by_fe) { /* remove the listener, but not those we need in the master... */ - if (!(l->options & LI_O_MWORKER)) { + if (!(l->rx.flags & RX_F_MWORKER)) { unbind_listener(l); delete_listener(l); } else {