Fixed Network's broken choice of next connectable peer.

Slight improvement to comment in Peer.
This commit is contained in:
catbref 2019-10-01 12:59:54 +01:00
parent 568a1f8a30
commit 381c032cec
2 changed files with 2 additions and 3 deletions

View File

@ -597,8 +597,7 @@ public class Network extends Thread {
// Don't consider peers with recent connection failures
final long lastAttemptedThreshold = now - CONNECT_FAILURE_BACKOFF;
peers.removeIf(peerData -> peerData.getLastAttempted() != null &&
peerData.getLastConnected() != null &&
peerData.getLastConnected() < peerData.getLastAttempted() &&
(peerData.getLastConnected() == null || peerData.getLastConnected() < peerData.getLastAttempted()) &&
peerData.getLastAttempted() > lastAttemptedThreshold);
// Don't consider peers that we know loop back to ourself

View File

@ -317,7 +317,7 @@ public class Peer {
}
if (message == null && bytesRead == 0 && !wasByteBufferFull)
// No complete message in buffer, no more bytes to read from socket and there was room to read bytes
// No complete message in buffer, no more bytes to read from socket even though there was room to read bytes
return;
if (message == null)