sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit e121462c58d7d27ee73e0091e0ef04631d418e53
parent eda1db3a81cec8839dd8c31b92439f9dcf6b5550
Author: wmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Date:   Mon, 16 Apr 2007 22:59:57 +0000

retry on imap ssl errors and better logging

git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@381 5c8cc53c-5e98-4d25-b20a-d8db53a31250

Diffstat:
M lib/sup/imap.rb | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/lib/sup/imap.rb b/lib/sup/imap.rb
@@ -34,7 +34,7 @@ class IMAP < Source
   SCAN_INTERVAL = 60 # seconds
 
   ## upon these errors we'll try to rereconnect a few times
-  RECOVERABLE_ERRORS = [ Errno::EPIPE, Errno::ETIMEDOUT ]
+  RECOVERABLE_ERRORS = [ Errno::EPIPE, Errno::ETIMEDOUT, OpenSSL::SSL::SSLError ]
 
   attr_accessor :username, :password
 
@@ -233,15 +233,17 @@ private
       begin
         unsafe_connect unless @imap
         yield
-      rescue *RECOVERABLE_ERRORS
+      rescue *RECOVERABLE_ERRORS => e
         if (retries += 1) <= 3
           @imap = nil
+          Redwood::log "got #{e.class.name}: #{e.message.inspect}"
+          sleep 2
           retry
         end
         raise
       end
     rescue SocketError, Net::IMAP::Error, SystemCallError, IOError, OpenSSL::SSL::SSLError => e
-      raise FatalSourceError, "While communicating with IMAP server (type #{e.class.name}): #{e.message}"
+      raise FatalSourceError, "While communicating with IMAP server (type #{e.class.name}): #{e.message.inspect}"
     end
   end