From: Timo Sirainen Date: Mon, 27 Oct 2025 11:12:07 +0000 (+0200) Subject: lib-master: Fix pre-accept() handling for services with restart_request_count=1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a21d7742f264f747e4f0516485f2d1f3883e2300;p=thirdparty%2Fdovecot%2Fcore.git lib-master: Fix pre-accept() handling for services with restart_request_count=1 Broken by 06045a9b2160229dcf78619f6208094843dfacd1 --- diff --git a/src/lib-master/master-service.c b/src/lib-master/master-service.c index ba198c2658..0073b39055 100644 --- a/src/lib-master/master-service.c +++ b/src/lib-master/master-service.c @@ -1228,11 +1228,20 @@ static void master_service_start_accepted_fd(struct master_service *service) void master_service_run(struct master_service *service, master_service_connection_callback_t *callback) { + bool run = TRUE; + service->callback = callback; if (service->accepted_listener_fd != -1) T_BEGIN { + /* Mark the ioloop as running, so we'll catch if + master_service_stop() -> io_loop_stop() is called. + If it is (e.g. due to restart_request_count=1) we don't + want to continue to io_loop_run() anymore. */ + io_loop_set_running(service->ioloop); master_service_start_accepted_fd(service); + run = io_loop_is_running(service->ioloop); } T_END; - io_loop_run(service->ioloop); + if (run) + io_loop_run(service->ioloop); service->callback = NULL; }