Author: dbkr
Date: 2008-05-14 23:28:56 +0000 (Wed, 14 May 2008)
New Revision: 19935

Modified:
   trunk/apps/Freemail/src/freemail/OutboundContact.java
Log:
Handle collisions on message inserts (should never happen under normal 
circumstances, but let's do it for good measure). Also add the error code for a 
failed message insert.


Modified: trunk/apps/Freemail/src/freemail/OutboundContact.java
===================================================================
--- trunk/apps/Freemail/src/freemail/OutboundContact.java       2008-05-14 
23:27:47 UTC (rev 19934)
+++ trunk/apps/Freemail/src/freemail/OutboundContact.java       2008-05-14 
23:28:56 UTC (rev 19935)
@@ -720,6 +720,10 @@
                                        msgs[i].first_send_time = 
System.currentTimeMillis();
                                msgs[i].last_send_time = 
System.currentTimeMillis();
                                msgs[i].saveProps();
+                       } else if (err.errorcode == 
FCPInsertErrorMessage.COLLISION) {
+                               msgs[i].slot = popNextSlot();
+                               Logger.error(this, "Insert collided! Assigned 
new slot: "+msgs[i].slot);
+                               msgs[i].saveProps();
                        } else if (msgs[i].added_time + FAIL_DELAY < 
System.currentTimeMillis()) {
                                Logger.normal(this,"Giving up on a message - 
been trying to send for too long. Bouncing.");
                                if 
(Postman.bounceMessage(msgs[i].getMessageFile(), account.getMessageBank(),
@@ -728,7 +732,7 @@
                                        msgs[i].delete();
                                }
                        } else {
-                               Logger.normal(this,"Failed to insert "+key+" 
will try again soon.");
+                               Logger.normal(this,"Failed to insert "+key+" 
(error code "+err.errorcode+") will try again soon.");
                        }
                }
        }


Reply via email to