[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [flashproxy/master] Put imap_login inside the exception block with imap_loop.



commit c47aa6e56fddead101c96238e35d7037aaaff092
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date:   Thu Oct 18 09:44:33 2012 -0700

    Put imap_login inside the exception block with imap_loop.
    
    I got an error that crashed the poller when it got disconnected and
    tried to reconnect:
    
    2012-10-18 05:37:28 lost server connection: command: SELECT => socket error: EOF
    2012-10-18 05:37:28 logging in as flashproxyreg.a@xxxxxxxxx
    Traceback (most recent call last):
      File "/usr/local/bin/facilitator-email-poller", line 358, in <module>
        imap = imap_login()
      File "/usr/local/bin/facilitator-email-poller", line 333, in imap_login
        imap.login(options.email_addr, email_password)
      File "/usr/lib/python2.6/imaplib.py", line 498, in login
        typ, dat = self._simple_command('LOGIN', user, self._quote(password))
      File "/usr/lib/python2.6/imaplib.py", line 1060, in _simple_command
        return self._command_complete(name, self._command(name, *args))
      File "/usr/lib/python2.6/imaplib.py", line 893, in _command_complete
        self._check_bye()
      File "/usr/lib/python2.6/imaplib.py", line 808, in _check_bye
        raise self.abort(bye[-1])
    imaplib.abort: [UNAVAILABLE] Temporary System Error
    
    We want to reconnect in this case. The rate limiter will make sure we
    don't retry too fast if it is a persistent error.
---
 facilitator/facilitator-email-poller |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/facilitator/facilitator-email-poller b/facilitator/facilitator-email-poller
index 8bb90ca..e9c5d3a 100755
--- a/facilitator/facilitator-email-poller
+++ b/facilitator/facilitator-email-poller
@@ -355,8 +355,8 @@ class RateLimit(object):
 
 login_limit = RateLimit()
 while True:
-    imap = imap_login()
     try:
+        imap = imap_login()
         imap_loop(imap)
     except imaplib.IMAP4.abort, e:
         # Try again after a disconnection.

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits