forked from I2P_Developers/i2p.i2p
BuildHandler: More early-disconnect cases
This commit is contained in:
@@ -451,6 +451,10 @@ class BuildHandler implements Runnable {
|
|||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.debug(state.msg.getUniqueId() + ": handling request after " + timeSinceReceived);
|
_log.debug(state.msg.getUniqueId() + ": handling request after " + timeSinceReceived);
|
||||||
|
|
||||||
|
Hash from = state.fromHash;
|
||||||
|
if (from == null && state.from != null)
|
||||||
|
from = state.from.calculateHash();
|
||||||
|
|
||||||
if (timeSinceReceived > (BuildRequestor.REQUEST_TIMEOUT*3)) {
|
if (timeSinceReceived > (BuildRequestor.REQUEST_TIMEOUT*3)) {
|
||||||
// don't even bother, since we are so overloaded locally
|
// don't even bother, since we are so overloaded locally
|
||||||
_context.throttle().setTunnelStatus(_x("Dropping tunnel requests: Overloaded"));
|
_context.throttle().setTunnelStatus(_x("Dropping tunnel requests: Overloaded"));
|
||||||
@@ -458,6 +462,8 @@ class BuildHandler implements Runnable {
|
|||||||
_log.warn("Not even trying to handle/decrypt the request " + state.msg.getUniqueId()
|
_log.warn("Not even trying to handle/decrypt the request " + state.msg.getUniqueId()
|
||||||
+ ", since we received it a long time ago: " + timeSinceReceived);
|
+ ", since we received it a long time ago: " + timeSinceReceived);
|
||||||
_context.statManager().addRateData("tunnel.dropLoadDelay", timeSinceReceived);
|
_context.statManager().addRateData("tunnel.dropLoadDelay", timeSinceReceived);
|
||||||
|
if (from != null)
|
||||||
|
_context.commSystem().mayDisconnect(from);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// ok, this is not our own tunnel, so we need to do some heavy lifting
|
// ok, this is not our own tunnel, so we need to do some heavy lifting
|
||||||
@@ -472,12 +478,11 @@ class BuildHandler implements Runnable {
|
|||||||
if (req == null) {
|
if (req == null) {
|
||||||
// no records matched, or the decryption failed. bah
|
// no records matched, or the decryption failed. bah
|
||||||
if (_log.shouldLog(Log.WARN)) {
|
if (_log.shouldLog(Log.WARN)) {
|
||||||
Hash from = state.fromHash;
|
|
||||||
if (from == null && state.from != null)
|
|
||||||
from = state.from.calculateHash();
|
|
||||||
_log.warn("The request " + state.msg.getUniqueId() + " could not be decrypted from: " + from);
|
_log.warn("The request " + state.msg.getUniqueId() + " could not be decrypted from: " + from);
|
||||||
}
|
}
|
||||||
_context.statManager().addRateData("tunnel.dropDecryptFail", 1);
|
_context.statManager().addRateData("tunnel.dropDecryptFail", 1);
|
||||||
|
if (from != null)
|
||||||
|
_context.commSystem().mayDisconnect(from);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -506,6 +511,8 @@ class BuildHandler implements Runnable {
|
|||||||
_log.warn("Drop next hop lookup, limit " + limit);
|
_log.warn("Drop next hop lookup, limit " + limit);
|
||||||
_context.statManager().addRateData("tunnel.dropLookupThrottle", 1);
|
_context.statManager().addRateData("tunnel.dropLookupThrottle", 1);
|
||||||
}
|
}
|
||||||
|
if (from != null)
|
||||||
|
_context.commSystem().mayDisconnect(from);
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
long beforeHandle = System.currentTimeMillis();
|
long beforeHandle = System.currentTimeMillis();
|
||||||
|
Reference in New Issue
Block a user