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 826a027a864a33c891821ee77362eb97a65d6edd..52f22cfc5f8e9e36f57e566266336772bc75ec01 100644 --- a/router/java/src/net/i2p/router/transport/udp/UDPTransport.java +++ b/router/java/src/net/i2p/router/transport/udp/UDPTransport.java @@ -1736,7 +1736,11 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority Long id = Long.valueOf(peer.getRcvConnID()); PeerStateDestroyed oldPSD; synchronized(_addDropLock) { - oldPSD = _recentlyClosedConnIDs.putIfAbsent(id, peer); + if (_recentlyClosedConnIDs.containsKey(id)){ + oldPSD = _recentlyClosedConnIDs.put(id, peer); + }else{ + oldPSD = _recentlyClosedConnIDs.get(id); + } } if (oldPSD != null) peer.kill(); @@ -1928,7 +1932,12 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority PeerState2 state2 = (PeerState2) oldPeer; Long id = Long.valueOf(state2.getRcvConnID()); PeerStateDestroyed newPSD = new PeerStateDestroyed(_context, this, state2); - PeerStateDestroyed oldPSD = _recentlyClosedConnIDs.putIfAbsent(id, newPSD); + PeerStateDestroyed oldPSD; + if (_recentlyClosedConnIDs.containsKey(id)){ + oldPSD = _recentlyClosedConnIDs.put(id, newPSD); + }else{ + oldPSD = _recentlyClosedConnIDs.get(id); + } if (oldPSD != null) newPSD.kill(); _peersByConnID.remove(id); @@ -2187,7 +2196,12 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority PeerState2 state2 = (PeerState2) peer; Long id = Long.valueOf(state2.getRcvConnID()); PeerStateDestroyed newPSD = new PeerStateDestroyed(_context, this, state2); - PeerStateDestroyed oldPSD = _recentlyClosedConnIDs.putIfAbsent(id, newPSD); + PeerStateDestroyed oldPSD; + if (_recentlyClosedConnIDs.containsKey(id)){ + oldPSD = _recentlyClosedConnIDs.put(id, newPSD); + }else{ + oldPSD = _recentlyClosedConnIDs.get(id); + } if (oldPSD != null) newPSD.kill(); _peersByConnID.remove(id);