]> granicus.if.org Git - neomutt/commitdiff
Try (once) to reconnect after an IMAP failure (#366)
authorPietro Cerutti <gahr@gahr.ch>
Mon, 6 Feb 2017 15:36:50 +0000 (15:36 +0000)
committerGitHub <noreply@github.com>
Mon, 6 Feb 2017 15:36:50 +0000 (15:36 +0000)
* 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

imap/command.c
imap/imap_private.h

index 7dde20f9a7cf80bcb2a8c623fb6ac6109af6246c..7a9a074f7c93f9451c3b3eeb91042578b9feddf5 100644 (file)
@@ -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. */
index 79f75e2eeea0fcf6a8a9f14082ea8039c249543b..9f5d6d50e5da5d639004bdb7318102508be4ebff 100644 (file)
@@ -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).