]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-master: If config socket closes, retry connecting to it automatically.
authorTimo Sirainen <tss@iki.fi>
Thu, 1 Aug 2013 10:51:57 +0000 (13:51 +0300)
committerTimo Sirainen <tss@iki.fi>
Thu, 1 Aug 2013 10:51:57 +0000 (13:51 +0300)
src/lib-master/master-service-settings.c

index fe028e26bd71432d14676af6b62f26495f5dec8e..5566d43e5e850aa36888cfbb1db7ec60f5271c6c 100644 (file)
@@ -367,20 +367,29 @@ int master_service_settings_read(struct master_service *service,
        unsigned int i;
        int ret, fd = -1;
        time_t now, timeout;
-       bool use_environment;
+       bool use_environment, retry;
 
        memset(output_r, 0, sizeof(*output_r));
 
        if (getenv("DOVECONF_ENV") == NULL &&
            (service->flags & MASTER_SERVICE_FLAG_NO_CONFIG_SETTINGS) == 0) {
-               fd = master_service_open_config(service, input, &path, error_r);
-               if (fd == -1)
-                       return -1;
-
-               if (config_send_request(service, input, fd, path, error_r) < 0) {
-                       i_close_fd(&fd);
-                       config_exec_fallback(service, input);
-                       return -1;
+               retry = service->config_fd != -1;
+               for (;;) {
+                       fd = master_service_open_config(service, input,
+                                                       &path, error_r);
+                       if (fd == -1)
+                               return -1;
+
+                       if (config_send_request(service, input, fd,
+                                               path, error_r) == 0)
+                               break;
+                       if (!retry) {
+                               i_close_fd(&fd);
+                               config_exec_fallback(service, input);
+                               return -1;
+                       }
+                       /* config process died, retry connecting */
+                       retry = FALSE;
                }
        }