forked from Qortal/qortal
Fixed Network's broken choice of next connectable peer.
Slight improvement to comment in Peer.
This commit is contained in:
parent
568a1f8a30
commit
381c032cec
@ -597,8 +597,7 @@ public class Network extends Thread {
|
|||||||
// Don't consider peers with recent connection failures
|
// Don't consider peers with recent connection failures
|
||||||
final long lastAttemptedThreshold = now - CONNECT_FAILURE_BACKOFF;
|
final long lastAttemptedThreshold = now - CONNECT_FAILURE_BACKOFF;
|
||||||
peers.removeIf(peerData -> peerData.getLastAttempted() != null &&
|
peers.removeIf(peerData -> peerData.getLastAttempted() != null &&
|
||||||
peerData.getLastConnected() != null &&
|
(peerData.getLastConnected() == null || peerData.getLastConnected() < peerData.getLastAttempted()) &&
|
||||||
peerData.getLastConnected() < peerData.getLastAttempted() &&
|
|
||||||
peerData.getLastAttempted() > lastAttemptedThreshold);
|
peerData.getLastAttempted() > lastAttemptedThreshold);
|
||||||
|
|
||||||
// Don't consider peers that we know loop back to ourself
|
// Don't consider peers that we know loop back to ourself
|
||||||
|
@ -317,7 +317,7 @@ public class Peer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (message == null && bytesRead == 0 && !wasByteBufferFull)
|
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;
|
return;
|
||||||
|
|
||||||
if (message == null)
|
if (message == null)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user