]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: When un-hibernating, send notification to imap-hibernate process earlier.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 2 Aug 2016 17:09:49 +0000 (20:09 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 4 Aug 2016 15:16:45 +0000 (18:16 +0300)
The initialization shouldn't take a long time, but there's really no need to
keep imap-hibernate itself waiting (and maybe timing out) if it does.

src/imap/imap-master-client.c

index d562d1baae2aa61d771dc47850a15f54ceeb2111..e24c0a94acbd8e81cc1eb6c6058724b783366e0d 100644 (file)
@@ -203,6 +203,10 @@ imap_master_client_input_args(struct connection *conn, const char *const *args,
                i_close_fd(&fd_client);
                return -1;
        }
+       /* Send a success notification before we start anything that lasts
+          potentially a long time. imap-hibernate process is waiting for us
+          to answer. Even if we fail later, we log the error anyway. */
+       o_stream_send_str(conn->output, "+\n");
 
        /* NOTE: before client_create_from_input() on failures we need to close
           fd_client, but afterward it gets closed by client_destroy() */
@@ -211,8 +215,6 @@ imap_master_client_input_args(struct connection *conn, const char *const *args,
        if (ret < 0) {
                i_error("imap-master(%s): Failed to create client: %s",
                        input.username, error);
-               o_stream_send_str(conn->output, t_strdup_printf(
-                       "-Failed to create client: %s\n", error));
                master_service_client_connection_destroyed(master_service);
                i_close_fd(&fd_client);
                return -1;
@@ -231,8 +233,6 @@ imap_master_client_input_args(struct connection *conn, const char *const *args,
                i_error("imap-master: Couldn't add %"PRIuSIZE_T
                        " bytes to client's input stream",
                        master_input.client_input->used);
-               o_stream_send_str(conn->output,
-                                 "-Couldn't add client input\n");
                client_destroy(imap_client, "Client initialization failed");
                return -1;
        }
@@ -255,7 +255,6 @@ imap_master_client_input_args(struct connection *conn, const char *const *args,
                        timeout_add(0, client_input, imap_client);
        }
 
-       o_stream_send_str(conn->output, "+\n");
        imap_refresh_proctitle();
        /* we'll always disconnect the client afterwards */
        return -1;