]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-master: Fix pre-accept() handling for services with restart_request_count=1 release-2.4.2 2.4.2
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 27 Oct 2025 11:12:07 +0000 (13:12 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Mon, 27 Oct 2025 12:46:42 +0000 (14:46 +0200)
Broken by 06045a9b2160229dcf78619f6208094843dfacd1

src/lib-master/master-service.c

index ba198c26588922fb3cb120042b3b05c0e4db85f5..0073b39055ed6db76269598aa8f8319e264812be 100644 (file)
@@ -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;
 }