diff options
author | Willy Tarreau <w@1wt.eu> | 2020-09-25 16:31:30 +0200 |
---|---|---|
committer | Willy Tarreau <w@1wt.eu> | 2020-10-07 18:45:03 +0200 |
commit | 13ee865befdfccf3049408fb72f61ba95f10624f (patch) | |
tree | 0ac584aac5e57a36596b4e661bd4ec9fa0c4f3cb | |
parent | 19f0bd90eec9e13798e3f3d064ee1172b22fce58 (diff) | |
download | haproxy-13ee865befdfccf3049408fb72f61ba95f10624f.tar.gz |
CLEANUP: listeners: remove unused disable_listener and disable_all_listeners
These ones have never been called, they were referenced by the protocol's
disable_all for some protocols but there are no traces of their use, so
in addition to not being sure the code works, it has never been tested.
Let's remove a bit of complexity starting from there.
-rw-r--r-- | include/haproxy/listener.h | 7 | ||||
-rw-r--r-- | src/listener.c | 34 |
2 files changed, 0 insertions, 41 deletions
diff --git a/include/haproxy/listener.h b/include/haproxy/listener.h index 3233ad5bc..e2574e678 100644 --- a/include/haproxy/listener.h +++ b/include/haproxy/listener.h @@ -56,13 +56,6 @@ int resume_listener(struct listener *l); */ int enable_all_listeners(struct protocol *proto); -/* This function removes all of the protocol's listener's file descriptors from - * the polling lists when they are in the LI_READY or LI_FULL states. It is - * intended to be used as a protocol's generic disable_all() primitive. It puts - * the listeners into LI_LISTEN, and always returns ERR_NONE. - */ -int disable_all_listeners(struct protocol *proto); - /* Dequeues all listeners waiting for a resource the global wait queue */ void dequeue_all_listeners(); diff --git a/src/listener.c b/src/listener.c index 874b852cf..f1f5c801d 100644 --- a/src/listener.c +++ b/src/listener.c @@ -309,23 +309,6 @@ static void enable_listener(struct listener *listener) HA_SPIN_UNLOCK(LISTENER_LOCK, &listener->lock); } -/* This function removes the specified listener's file descriptor from the - * polling lists if it is in the LI_READY or in the LI_FULL state. The listener - * enters LI_LISTEN. - */ -static void disable_listener(struct listener *listener) -{ - HA_SPIN_LOCK(LISTENER_LOCK, &listener->lock); - if (listener->state < LI_READY) - goto end; - if (listener->state == LI_READY) - fd_stop_recv(listener->rx.fd); - MT_LIST_DEL(&listener->wait_queue); - listener_set_state(listener, LI_LISTEN); - end: - HA_SPIN_UNLOCK(LISTENER_LOCK, &listener->lock); -} - /* This function tries to temporarily disable a listener, depending on the OS * capabilities. Linux unbinds the listen socket after a SHUT_RD, and ignores * SHUT_WR. Solaris refuses either shutdown(). OpenBSD ignores SHUT_RD but @@ -498,23 +481,6 @@ int enable_all_listeners(struct protocol *proto) return ERR_NONE; } -/* This function removes all of the protocol's listener's file descriptors from - * the polling lists when they are in the LI_READY or LI_FULL states. It is - * intended to be used as a protocol's generic disable_all() primitive. It puts - * the listeners into LI_LISTEN, and always returns ERR_NONE. - * - * Must be called with proto_lock held. - * - */ -int disable_all_listeners(struct protocol *proto) -{ - struct listener *listener; - - list_for_each_entry(listener, &proto->listeners, rx.proto_list) - disable_listener(listener); - return ERR_NONE; -} - /* Dequeues all listeners waiting for a resource the global wait queue */ void dequeue_all_listeners() { |