MEDIUM: listener: support rebinding during resume()
When a listener resumes operations, supporting a full rebind makes it possible to perform a full stop as a pause(). This will be used for pausing abstract namespace unix sockets.
This commit is contained in:
parent
092d865c53
commit
1c4b814087
|
@ -120,10 +120,26 @@ int pause_listener(struct listener *l)
|
|||
* may replace enable_listener(). The resulting state will either be LI_READY
|
||||
* or LI_FULL. 0 is returned in case of failure to resume (eg: dead socket).
|
||||
* Listeners bound to a different process are not woken up unless we're in
|
||||
* foreground mode.
|
||||
* foreground mode. If the listener was only in the assigned state, it's totally
|
||||
* rebound. This can happen if a pause() has completely stopped it. If the
|
||||
* resume fails, 0 is returned and an error might be displayed.
|
||||
*/
|
||||
int resume_listener(struct listener *l)
|
||||
{
|
||||
if (l->state == LI_ASSIGNED) {
|
||||
char msg[100];
|
||||
int err;
|
||||
|
||||
err = l->proto->bind(l, msg, sizeof(msg));
|
||||
if (err & ERR_ALERT)
|
||||
Alert("Resuming listener: %s\n", msg);
|
||||
else if (err & ERR_WARN)
|
||||
Warning("Resuming listener: %s\n", msg);
|
||||
|
||||
if (err & (ERR_FATAL | ERR_ABORT))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (l->state < LI_PAUSED)
|
||||
return 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue