mirror of
https://github.com/i2p/i2p.i2p.git
synced 2024-12-06 19:27:00 +01:00
use a containsKey()+put instead of putIfAbsent because putIfAbsent is not present in Java 8, thereby breaking Maven builds
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user