Skip to content

Commit

Permalink
imapc: Code cleanup - imapc_connection_reconnect() is now always call…
Browse files Browse the repository at this point in the history
…ed when reconnect is ok.
  • Loading branch information
sirainen authored and GitLab committed Apr 12, 2016
1 parent 8cd9a12 commit 5ba8e64
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/lib-imap-client/imapc-client.c
Expand Up @@ -319,21 +319,16 @@ bool imapc_client_mailbox_can_reconnect(struct imapc_client_mailbox *box)

void imapc_client_mailbox_reconnect(struct imapc_client_mailbox *box)
{
bool reconnect = imapc_client_mailbox_can_reconnect(box);
i_assert(!box->reconnecting);

if (reconnect) {
i_assert(!box->reconnecting);
box->reconnecting = TRUE;
}
imapc_connection_disconnect(box->conn);
if (reconnect) {
imapc_connection_connect(box->conn,
imapc_client_reconnect_cb, box);
}
box->reconnecting = TRUE;
/* if we fail again, avoid reconnecting immediately. if the server is
broken we could just get into an infinitely failing reconnection
loop. */
box->reconnect_ok = FALSE;

imapc_connection_disconnect(box->conn);
imapc_connection_connect(box->conn, imapc_client_reconnect_cb, box);
}

void imapc_client_mailbox_close(struct imapc_client_mailbox **_box)
Expand Down

0 comments on commit 5ba8e64

Please sign in to comment.