* I2CP: Failsafe check for delivery job requeueing forever (ticket #819)

This commit is contained in:
zzz
2013-01-12 18:18:17 +00:00
parent 083dffe8ed
commit 4f146772e7
3 changed files with 23 additions and 6 deletions

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 4;
public final static long BUILD = 5;
/** for example "-test" */
public final static String EXTRA = "";

View File

@ -628,11 +628,13 @@ class ClientConnectionRunner {
*
*/
private final static long REQUEUE_DELAY = 500;
private static final int MAX_REQUEUE = 60; // 30 sec.
private class MessageDeliveryStatusUpdate extends JobImpl {
private final MessageId _messageId;
private final int _status;
private long _lastTried;
private int _requeueCount;
/**
* Do not use for status = STATUS_SEND_ACCEPTED; use ackSendMessage() for that.
@ -662,12 +664,20 @@ class ClientConnectionRunner {
msg.setStatus(_status);
if (!alreadyAccepted(_messageId)) {
_log.warn("Almost send an update for message " + _messageId + " to "
if (_requeueCount++ > MAX_REQUEUE) {
// bug requeueing forever? failsafe
_log.error("Abandon update for message " + _messageId + " to "
+ MessageStatusMessage.getStatusString(msg.getStatus())
+ " for session " + _sessionId.getSessionId()
+ " for session " + _sessionId.getSessionId());
} else {
if (_log.shouldLog(Log.WARN))
_log.warn("Almost send an update for message " + _messageId + " to "
+ MessageStatusMessage.getStatusString(msg.getStatus())
+ " for session " + _sessionId.getSessionId()
+ " before they knew the messageId! delaying .5s");
_lastTried = _context.clock().now();
requeue(REQUEUE_DELAY);
_lastTried = _context.clock().now();
requeue(REQUEUE_DELAY);
}
return;
}