From 03dfa6515b15c87af23cd6577b7f1dae7a8d00ad Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Wed, 27 May 2015 20:54:22 +0000 Subject: [PATCH] SSU: send destroy message in a couple cases where we previously just called dropPeer() --- .../router/transport/udp/UDPTransport.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/router/java/src/net/i2p/router/transport/udp/UDPTransport.java b/router/java/src/net/i2p/router/transport/udp/UDPTransport.java index a502eb327b..7429314f62 100644 --- a/router/java/src/net/i2p/router/transport/udp/UDPTransport.java +++ b/router/java/src/net/i2p/router/transport/udp/UDPTransport.java @@ -1310,6 +1310,8 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority markUnreachable(peerHash); _context.banlist().banlistRouter(peerHash, "Part of the wrong network, version = " + ((RouterInfo) entry).getVersion()); //_context.banlist().banlistRouter(peerHash, "Part of the wrong network", STYLE); + if (peer != null) + sendDestroy(peer); dropPeer(peerHash, false, "wrong network"); if (_log.shouldLog(Log.WARN)) _log.warn("Dropping the peer " + peerHash + " because they are in the wrong net: " + entry); @@ -1343,12 +1345,22 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority boolean isInDropList(RemoteHostId peer) { return _dropList.contains(peer); } + /** + * This does not send a session destroy, caller must do that if desired. + * + * @param shouldBanlist doesn't really, only sets unreachable + */ void dropPeer(Hash peer, boolean shouldBanlist, String why) { PeerState state = getPeerState(peer); if (state != null) dropPeer(state, shouldBanlist, why); } + /** + * This does not send a session destroy, caller must do that if desired. + * + * @param shouldBanlist doesn't really, only sets unreachable + */ void dropPeer(PeerState peer, boolean shouldBanlist, String why) { if (_log.shouldLog(Log.INFO)) { long now = _context.clock().now(); @@ -1402,6 +1414,11 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority rebuildIfNecessary(); } + /** + * This does not send a session destroy, caller must do that if desired. + * + * @param shouldBanlist doesn't really, only sets unreachable + */ private void locked_dropPeer(PeerState peer, boolean shouldBanlist, String why) { peer.dropOutbound(); peer.expireInboundMessages(); @@ -1562,7 +1579,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority * * @since 0.8.9 */ - private void sendDestroy(PeerState peer) { + void sendDestroy(PeerState peer) { // peer must be fully established if (peer.getCurrentCipherKey() == null) return; @@ -2265,6 +2282,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority // ok, a few conseutive failures, but we /are/ getting through to them } else { _context.statManager().addRateData("udp.dropPeerConsecutiveFailures", consecutive, msg.getPeer().getInactivityTime()); + sendDestroy(msg.getPeer()); dropPeer(msg.getPeer(), false, "too many failures"); } //if ( (consecutive > MAX_CONSECUTIVE_FAILED) && (msg.getPeer().getInactivityTime() > DROP_INACTIVITY_TIME)) -- GitLab