MINOR: listener: small API change

A minor API change was performed in listener(.c/.h) to restore consistency
between stop_listener() and (resume/pause)_listener() functions.

LISTENER_LOCK was never locked prior to calling stop_listener():
lli variable hint is thus not useful anymore.

Added PROXY_LOCK locking in (resume/pause)_listener() functions
with related lpx variable hint (prerequisite for #1626).

It should be backported to 2.6, 2.5 and 2.4
This commit is contained in:
Aurelien DARRAGON
2022-09-09 15:32:57 +02:00
committed by Christopher Faulet
parent 7d00077fd5
commit 001328873c
4 changed files with 53 additions and 28 deletions

View File

@@ -42,23 +42,29 @@ void listener_set_state(struct listener *l, enum li_state st);
* closes upon SHUT_WR and refuses to rebind. So a common validation path
* involves SHUT_WR && listen && SHUT_RD. In case of success, the FD's polling
* is disabled. It normally returns non-zero, unless an error is reported.
* It will need to operate under the proxy's lock. The caller is
* responsible for indicating in lpx whether the proxy locks is
* already held (non-zero) or not (zero) so that the function picks it.
*/
int pause_listener(struct listener *l);
int pause_listener(struct listener *l, int lpx);
/* This function tries to resume a temporarily disabled listener.
* The resulting state will either be LI_READY or LI_FULL. 0 is returned
* in case of failure to resume (eg: dead socket).
* It will need to operate under the proxy's lock. The caller is
* responsible for indicating in lpx whether the proxy locks is
* already held (non-zero) or not (zero) so that the function picks it.
*/
int resume_listener(struct listener *l);
int resume_listener(struct listener *l, int lpx);
/*
* This function completely stops a listener. It will need to operate under the
* proxy's lock, the protocol's lock, and the listener's lock. The caller is
* responsible for indicating in lpx, lpr, lli whether the respective locks are
* proxy's lock and the protocol's lock. The caller is
* responsible for indicating in lpx, lpr whether the respective locks are
* already held (non-zero) or not (zero) so that the function picks the missing
* ones, in this order.
*/
void stop_listener(struct listener *l, int lpx, int lpr, int lli);
void stop_listener(struct listener *l, int lpx, int lpr);
/* This function adds the specified listener's file descriptor to the polling
* lists if it is in the LI_LISTEN state. The listener enters LI_READY or