Skip to content

Commit

Permalink
Try (once) to reconnect after an IMAP failure (#366)
Browse files Browse the repository at this point in the history
* Try (once) to reconnect after an IMAP failure

Closes #346

* Keep recovering state in IMAP_DATA instead of in a static local variable

Closes #346
  • Loading branch information
gahr committed Feb 6, 2017
1 parent 71fb7cc commit d89559a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions imap/command.c
Expand Up @@ -451,8 +451,14 @@ static void cmd_handle_fatal (IMAP_DATA* idata)
idata->state = IMAP_DISCONNECTED;
}

if (idata->state < IMAP_SELECTED)
imap_close_connection (idata);
imap_close_connection (idata);
if (!idata->recovering)
{
idata->recovering = 1;
if (imap_conn_find (&idata->conn->account, 0))
mutt_clear_error ();
idata->recovering = 0;
}
}

/* cmd_handle_untagged: fallback parser for otherwise unhandled messages. */
Expand Down
1 change: 1 addition & 0 deletions imap/imap_private.h
Expand Up @@ -170,6 +170,7 @@ typedef struct
{
/* This data is specific to a CONNECTION to an IMAP server */
CONNECTION *conn;
unsigned char recovering;
unsigned char state;
unsigned char status;
/* let me explain capstr: SASL needs the capability string (not bits).
Expand Down

0 comments on commit d89559a

Please sign in to comment.