mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-14 15:34:35 +00:00
MINOR: protocol: add protocol_stop_now() to instant-stop listeners
This will instantly stop all listeners except those which belong to a proxy configured with a grace time. This means that UDP listeners, and peers will also be stopped when called this way.
This commit is contained in:
parent
acde152175
commit
02e8557e88
@ -50,6 +50,14 @@ int protocol_bind_all(int verbose);
|
||||
*/
|
||||
int protocol_unbind_all(void);
|
||||
|
||||
/* stops all listeners of all registered protocols, except when the belong to a
|
||||
* proxy configured with a grace time. This will normally catch every single
|
||||
* listener, all protocols included, and the grace ones will have to be handled
|
||||
* by the proxy stopping loop. This is to be used during soft_stop() only. It
|
||||
* does not return any error.
|
||||
*/
|
||||
void protocol_stop_now(void);
|
||||
|
||||
/* pauses all listeners of all registered protocols. This is typically
|
||||
* used on SIG_TTOU to release all listening sockets for the time needed to
|
||||
* try to bind a new process. The listeners enter LI_PAUSED. It returns
|
||||
|
@ -151,6 +151,26 @@ int protocol_unbind_all(void)
|
||||
return err;
|
||||
}
|
||||
|
||||
/* stops all listeners of all registered protocols, except when the belong to a
|
||||
* proxy configured with a grace time. This will normally catch every single
|
||||
* listener, all protocols included, and the grace ones will have to be handled
|
||||
* by the proxy stopping loop. This is to be used during soft_stop() only. It
|
||||
* does not return any error.
|
||||
*/
|
||||
void protocol_stop_now(void)
|
||||
{
|
||||
struct protocol *proto;
|
||||
struct listener *listener, *lback;
|
||||
|
||||
HA_SPIN_LOCK(PROTO_LOCK, &proto_lock);
|
||||
list_for_each_entry(proto, &protocols, list) {
|
||||
list_for_each_entry_safe(listener, lback, &proto->receivers, rx.proto_list)
|
||||
if (!listener->bind_conf->frontend->grace)
|
||||
stop_listener(listener, 0, 1, 0);
|
||||
}
|
||||
HA_SPIN_UNLOCK(PROTO_LOCK, &proto_lock);
|
||||
}
|
||||
|
||||
/* pauses all listeners of all registered protocols. This is typically
|
||||
* used on SIG_TTOU to release all listening sockets for the time needed to
|
||||
* try to bind a new process. The listeners enter LI_PAUSED. It returns
|
||||
|
Loading…
Reference in New Issue
Block a user