Refactoring: Rename INITIAL_DATA_REQUEST to INITIAL_DATA_EXCHANGE

This commit is contained in:
chimp1984 2021-01-05 20:40:37 -05:00
parent 15cd42de0c
commit 809484e65d
No known key found for this signature in database
GPG Key ID: 9801B4EC591F90E3
4 changed files with 4 additions and 4 deletions

View File

@ -861,7 +861,7 @@ public class Connection implements HasCapabilities, Runnable, MessageListener {
statistic.updateLastActivityTimestamp();
if (networkEnvelope instanceof GetDataRequest)
setPeerType(PeerType.INITIAL_DATA_REQUEST);
setPeerType(PeerType.INITIAL_DATA_EXCHANGE);
// First a seed node gets a message from a peer (PreliminaryDataRequest using
// AnonymousMessage interface) which does not have its hidden service

View File

@ -21,5 +21,5 @@ public enum PeerType {
SEED_NODE,
PEER,
DIRECT_MSG_PEER,
INITIAL_DATA_REQUEST
INITIAL_DATA_EXCHANGE
}

View File

@ -536,7 +536,7 @@ public final class PeerManager implements ConnectionListener, PersistedDataHost
"of type DIRECT_MSG_PEER or INITIAL_DATA_REQUEST.", maxConnectionsNonDirect);
candidates = allConnections.stream()
.filter(e -> e.getPeerType() != PeerType.DIRECT_MSG_PEER &&
e.getPeerType() != PeerType.INITIAL_DATA_REQUEST)
e.getPeerType() != PeerType.INITIAL_DATA_EXCHANGE)
.collect(Collectors.toList());
if (candidates.isEmpty()) {

View File

@ -159,7 +159,7 @@ public class PeerManagerTest {
assertEquals(maxConnectionsNonDirect + 1, node.getNetworkNode().getAllConnections().size());
List<Connection> sortedPeerConnections = node.getNetworkNode().getAllConnections().stream()
.filter(e -> e.getPeerType() != PeerType.DIRECT_MSG_PEER &&
e.getPeerType() != PeerType.INITIAL_DATA_REQUEST)
e.getPeerType() != PeerType.INITIAL_DATA_EXCHANGE)
.sorted(Comparator.comparingLong(o -> o.getStatistic().getLastActivityTimestamp()))
.collect(Collectors.toList());
Connection oldestConnection = sortedPeerConnections.remove(0);