forked from I2P_Developers/i2p.i2p
SSU2: Post-termination handler part 5 WIP
Don't create a new inbound token if we have one that's still good, for when the handler retransmits terminations
This commit is contained in:
@@ -2668,7 +2668,16 @@ class EstablishmentManager {
|
||||
long expires = now + expiration;
|
||||
Token tok = new Token(token, expires, now);
|
||||
synchronized(_inboundTokens) {
|
||||
_inboundTokens.put(peer, tok);
|
||||
Token old = _inboundTokens.put(peer, tok);
|
||||
if (old != null && old.getExpiration() > expires - 2*60*1000) {
|
||||
// reuse for the case where we're retransmitting terminations
|
||||
// and it expires no sooner than 2 minutes earlier
|
||||
if (_log.shouldDebug())
|
||||
_log.debug("Resend inbound " + old + " for " + peer);
|
||||
// put it back
|
||||
_inboundTokens.put(peer, old);
|
||||
return old;
|
||||
}
|
||||
}
|
||||
if (_log.shouldDebug())
|
||||
_log.debug("Add inbound " + tok + " for " + peer);
|
||||
|
||||
Reference in New Issue
Block a user