]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
master: Stopping didn't close dead-pipes early enough.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 30 Jun 2016 11:08:24 +0000 (14:08 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 30 Jun 2016 11:12:11 +0000 (14:12 +0300)
This caused stopping to be too slow. Broken by 0153cf542.

src/master/service-monitor.c

index 19655c2c39b92544bac38f3fb920a850d4262280..44cdb2696b2f4bb905245f825c482d0b0a2b8f69 100644 (file)
@@ -505,6 +505,14 @@ void services_monitor_start(struct service_list *service_list)
        }
 }
 
+static void service_monitor_close_dead_pipe(struct service *service)
+{
+       if (service->master_dead_pipe_fd[0] != -1) {
+               i_close_fd(&service->master_dead_pipe_fd[0]);
+               i_close_fd(&service->master_dead_pipe_fd[1]);
+       }
+}
+
 void service_monitor_stop(struct service *service)
 {
        int i;
@@ -522,10 +530,7 @@ void service_monitor_stop(struct service *service)
                        service->status_fd[i] = -1;
                }
        }
-       if (service->master_dead_pipe_fd[0] != -1) {
-               i_close_fd(&service->master_dead_pipe_fd[0]);
-               i_close_fd(&service->master_dead_pipe_fd[1]);
-       }
+       service_monitor_close_dead_pipe(service);
        if (service->login_notify_fd != -1) {
                if (close(service->login_notify_fd) < 0) {
                        service_error(service,
@@ -582,6 +587,9 @@ void services_monitor_stop(struct service_list *service_list, bool wait)
 {
        struct service *const *services;
 
+       array_foreach(&service_list->services, services)
+               service_monitor_close_dead_pipe(*services);
+
        if (wait) {
                /* we've notified all children that the master is dead.
                   now wait for the children to either die or to tell that