fixed bug that could cause Outgoing thread to get stuck
authoradam <adam@megacz.com>
Mon, 13 Mar 2006 08:03:43 +0000 (08:03 +0000)
committeradam <adam@megacz.com>
Mon, 13 Mar 2006 08:03:43 +0000 (08:03 +0000)
darcs-hash:20060313080343-5007d-3bd14dd230e83dfe9fd8310359d9f5d9167c61a3.gz

src/org/ibex/mail/protocol/SMTP.java

index c3be6a4..1ba2090 100644 (file)
@@ -308,7 +308,13 @@ public class SMTP {
                         }
                     }
                     if (!good) break;
-                    if (attempt(it.cur())) it.delete();
+                   try {
+                       if (attempt(it.cur())) it.delete();
+                   } catch (Exception e) {
+                       Log.error(SMTP.Outgoing.class, e);
+                   }
+                    Log.info(this, "sleeping for 3s...");
+                    Thread.sleep(3000);
                 }
             } catch (Exception e) {
                 //if (e instanceof InterruptedException) throw e;
@@ -323,6 +329,7 @@ public class SMTP {
                 while(true) {
                     Log.setThreadAnnotation("[outgoing #"+serial+"] ");
                     wake();
+                    Thread.sleep(1000);
                     synchronized(Outgoing.class) {
                         Outgoing.class.wait(5 * 60 * 1000);
                     }