commit 801af81ae5311dc9cf7511996ab1a16501c0d0c5 Author: David Fifield david@bamsoftware.com Date: Wed Oct 9 13:40:05 2013 -0700
close and logout only if we logged in.
I was getting a NameError referring to "imap" if the exception happened in imap_login. --- facilitator/facilitator-email-poller | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/facilitator/facilitator-email-poller b/facilitator/facilitator-email-poller index 33d4ed7..6691afc 100755 --- a/facilitator/facilitator-email-poller +++ b/facilitator/facilitator-email-poller @@ -407,19 +407,17 @@ login_limit = RateLimit() while True: try: imap = imap_login() - imap_loop(imap) + try: + imap_loop(imap) + except imaplib.IMAP4.error: + imap.close() + imap.logout() except (imaplib.IMAP4.error, ssl.SSLError, SSL.SSLError, socket.error), e: # Try again after a disconnection. log(u"lost server connection: %s" % str(e)) except KeyboardInterrupt: break
- try: - imap.close() - imap.logout() - except (imaplib.IMAP4.abort, imaplib.IMAP4.error): - pass - # Don't reconnect too fast. t = login_limit.time_to_wait() if t > 0:
tor-commits@lists.torproject.org