Skip to content

Commit

Permalink
imap: When un-hibernating, send notification to imap-hibernate proces…
Browse files Browse the repository at this point in the history
…s 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.
  • Loading branch information
sirainen committed Aug 2, 2016
1 parent c7a9a1f commit 50da38c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/imap/imap-master-client.c
Expand Up @@ -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() */
Expand All @@ -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;
Expand All @@ -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;
}
Expand All @@ -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;
Expand Down

0 comments on commit 50da38c

Please sign in to comment.