Mercurial > dovecot > core-2.2
changeset 20554:dcf9cc6ee647
imap: When un-hibernating, send notification to imap-hibernate process earlier.
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.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Tue, 02 Aug 2016 20:09:49 +0300 |
parents | 63a54b6d58a1 |
children | d5642dc6cccc |
files | src/imap/imap-master-client.c |
diffstat | 1 files changed, 4 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/imap/imap-master-client.c Tue Aug 02 20:03:01 2016 +0300 +++ b/src/imap/imap-master-client.c Tue Aug 02 20:09:49 2016 +0300 @@ -203,6 +203,10 @@ 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 @@ 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 @@ 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 @@ 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;