mirror of
https://github.com/Qortal/qortal.git
synced 2025-03-13 19:12:33 +00:00
Revert "Rewrite of isNotOldPeer predicate, to fix logic issue."
This reverts commit d81071f2544ec72807f70892388ae2ddec8dbc8c.
This commit is contained in:
parent
db8f627f1a
commit
3af36644c0
@ -1373,26 +1373,17 @@ public class Network {
|
|||||||
// We attempted to connect within the last day
|
// We attempted to connect within the last day
|
||||||
// but we last managed to connect over a week ago.
|
// but we last managed to connect over a week ago.
|
||||||
Predicate<PeerData> isNotOldPeer = peerData -> {
|
Predicate<PeerData> isNotOldPeer = peerData -> {
|
||||||
|
|
||||||
// First check if there was a connection attempt within the last day
|
|
||||||
if (peerData.getLastAttempted() == null
|
if (peerData.getLastAttempted() == null
|
||||||
|| peerData.getLastAttempted() < now - OLD_PEER_ATTEMPTED_PERIOD) {
|
|| peerData.getLastAttempted() < now - OLD_PEER_ATTEMPTED_PERIOD) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// There was, so now check if we had a successful connection in the last 7 days
|
|
||||||
if (peerData.getLastConnected() == null
|
if (peerData.getLastConnected() == null
|
||||||
|| peerData.getLastConnected() > now - OLD_PEER_CONNECTION_PERIOD) {
|
|| peerData.getLastConnected() > now - OLD_PEER_CONNECTION_PERIOD) {
|
||||||
|
|
||||||
// We did, so this is NOT an 'old' peer
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Last successful connection was more than 1 week ago - this is an 'old' peer
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Best to wait until we have a connection attempt - assume not an 'old' peer until then
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Disregard peers that are NOT 'old'
|
// Disregard peers that are NOT 'old'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user