projects
/
org.ibex.mail.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
851c382
)
add delayed retry for SMTP
author
adam
<adam@megacz.com>
Sat, 1 Mar 2008 06:01:27 +0000
(06:01 +0000)
committer
adam
<adam@megacz.com>
Sat, 1 Mar 2008 06:01:27 +0000
(06:01 +0000)
darcs-hash:
20080301060127
-5007d-
e11089dc22906e76adf872a6fe4746d805fc5d96
.gz
src/org/ibex/mail/SMTP.java
patch
|
blob
|
history
diff --git
a/src/org/ibex/mail/SMTP.java
b/src/org/ibex/mail/SMTP.java
index
64677a0
..
cf86164
100644
(file)
--- a/
src/org/ibex/mail/SMTP.java
+++ b/
src/org/ibex/mail/SMTP.java
@@
-53,6
+53,8
@@
public class SMTP {
public static final int GRAYLIST_MINWAIT = 1000 * 60 * 60; // one hour
public static final int GRAYLIST_MAXWAIT = 1000 * 60 * 60 * 24 * 5; // five days
public static final int GRAYLIST_MINWAIT = 1000 * 60 * 60; // one hour
public static final int GRAYLIST_MAXWAIT = 1000 * 60 * 60 * 24 * 5; // five days
+ public static final int RETRY_TIME = 1000 * 60 * 30;
+
public static final Graylist graylist;
public static final Whitelist whitelist;
static {
public static final Graylist graylist;
public static final Whitelist whitelist;
static {
@@
-444,6
+446,8
@@
public class SMTP {
private int serial = serials++;
private Mailbox.Iterator it;
private int serial = serials++;
private Mailbox.Iterator it;
+ private static Map<String,Long> nextTry = Collections.synchronizedMap(new HashMap<String,Long>());
+
public Outgoing() {
synchronized(Outgoing.class) {
threads.add(this);
public Outgoing() {
synchronized(Outgoing.class) {
threads.add(this);
@@
-468,7
+472,12
@@
public class SMTP {
}
if (!good) break;
try {
}
if (!good) break;
try {
- if (attempt(it.cur())) it.delete();
+ String messageid = it.cur().messageid;
+ if (nextTry.get(messageid) == null || System.currentTimeMillis() > nextTry.get(messageid)) {
+ boolean ok = attempt(it.cur());
+ if (ok) it.delete();
+ else nextTry.put(messageid, System.currentTimeMillis() + RETRY_TIME);
+ }
} catch (Exception e) {
Log.error(SMTP.Outgoing.class, e);
}
} catch (Exception e) {
Log.error(SMTP.Outgoing.class, e);
}