mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 13:51:26 +02:00
MEDIUM: listeners: support unstoppable listener
An unstoppable listener is a listener which won't be stop during a soft stop. The unstoppable_jobs variable is incremented and the listener won't prevent the process to leave properly. It is not a good idea to use this feature (the LI_O_NOSTOP flag) with a listener that need to be bind again on another process during a soft reload.
This commit is contained in:
parent
a719926cf8
commit
c59f9884d7
@ -101,6 +101,7 @@ enum li_state {
|
|||||||
#define LI_O_ACC_CIP 0x1000 /* find the proxied address in the NetScaler Client IP header */
|
#define LI_O_ACC_CIP 0x1000 /* find the proxied address in the NetScaler Client IP header */
|
||||||
#define LI_O_INHERITED 0x2000 /* inherited FD from the parent process (fd@) */
|
#define LI_O_INHERITED 0x2000 /* inherited FD from the parent process (fd@) */
|
||||||
#define LI_O_MWORKER 0x4000 /* keep the FD open in the master but close it in the children */
|
#define LI_O_MWORKER 0x4000 /* keep the FD open in the master but close it in the children */
|
||||||
|
#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
|
/* Note: if a listener uses LI_O_UNLIMITED, it is highly recommended that it adds its own
|
||||||
* maxconn setting to the global.maxsock value so that its resources are reserved.
|
* maxconn setting to the global.maxsock value so that its resources are reserved.
|
||||||
|
@ -1110,19 +1110,26 @@ void zombify_proxy(struct proxy *p)
|
|||||||
* This function completely stops a proxy and releases its listeners. It has
|
* This function completely stops a proxy and releases its listeners. It has
|
||||||
* to be called when going down in order to release the ports so that another
|
* to be called when going down in order to release the ports so that another
|
||||||
* process may bind to them. It must also be called on disabled proxies at the
|
* process may bind to them. It must also be called on disabled proxies at the
|
||||||
* end of start-up. When all listeners are closed, the proxy is set to the
|
* end of start-up. If all listeners are closed, the proxy is set to the
|
||||||
* PR_STSTOPPED state.
|
* PR_STSTOPPED state.
|
||||||
*/
|
*/
|
||||||
void stop_proxy(struct proxy *p)
|
void stop_proxy(struct proxy *p)
|
||||||
{
|
{
|
||||||
struct listener *l;
|
struct listener *l;
|
||||||
|
int nostop = 0;
|
||||||
|
|
||||||
list_for_each_entry(l, &p->conf.listeners, by_fe) {
|
list_for_each_entry(l, &p->conf.listeners, by_fe) {
|
||||||
|
if (l->options & LI_O_NOSTOP) {
|
||||||
|
HA_ATOMIC_ADD(&unstoppable_jobs, 1);
|
||||||
|
nostop = 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
unbind_listener(l);
|
unbind_listener(l);
|
||||||
if (l->state >= LI_ASSIGNED) {
|
if (l->state >= LI_ASSIGNED) {
|
||||||
delete_listener(l);
|
delete_listener(l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!nostop)
|
||||||
p->state = PR_STSTOPPED;
|
p->state = PR_STSTOPPED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user