New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Try (once) to reconnect after an IMAP failure #366
Conversation
@neomutt/reviewers Please review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... the code seems too simple to be that useful.
Killing the connection with tcpkill
causes it to reconnect (once).
Kill it again and the mailbox is left closed.
Nice.
imap/command.c
Outdated
@@ -440,6 +440,7 @@ static int cmd_status (const char *s) | |||
/* cmd_handle_fatal: when IMAP_DATA is in fatal state, do what we can */ | |||
static void cmd_handle_fatal (IMAP_DATA* idata) | |||
{ | |||
static int try_reconnect = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we keep the function reentrant by moving this to IMAP_DATA? Otherwise 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function is reentrant, just it doesn't behave the same once reentred ;) I don't see a benefit to moving this local piece of data to IMAP_DATA. What am I missing?
@flatcap that is surprising... the "once" in the comment was meant to be "once per failure", that is, if mutt can't re-establish a connection on failure, it doesn't try again. That's the reason for the If it doesn't reconnect upon a second (unrelated, long after reconnection) failure, then there's still something I have to look at. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Note for other readers: IMAP_DATA is allocated with safe_calloc, so this new member will be correctly initialized.
Closes #346