diff --git a/src/listener.c b/src/listener.c index 67f8ca7d43..11df69fd17 100644 --- a/src/listener.c +++ b/src/listener.c @@ -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;