Refactor: Rename method

This commit is contained in:
chimp1984 2020-10-07 18:46:08 -05:00
parent ed960aba3f
commit 0686079946
No known key found for this signature in database
GPG Key ID: 9801B4EC591F90E3
4 changed files with 6 additions and 7 deletions

View File

@ -180,7 +180,7 @@ public class LiteNodeNetworkService implements MessageListener, ConnectionListen
public void onDisconnect(CloseConnectionReason closeConnectionReason, Connection connection) {
closeHandler(connection);
if (peerManager.isNodeBanned(closeConnectionReason, connection)) {
if (peerManager.isPeerBanned(closeConnectionReason, connection)) {
connection.getPeersNodeAddressOptional().ifPresent(nodeAddress -> {
seedNodeAddresses.remove(nodeAddress);
removeFromRequestBlocksHandlerMap(nodeAddress);

View File

@ -287,14 +287,13 @@ public final class PeerManager implements ConnectionListener, PersistedDataHost
return seedNodeAddresses.contains(nodeAddress);
}
//TODO rename
public boolean isNodeBanned(CloseConnectionReason closeConnectionReason, Connection connection) {
public boolean isPeerBanned(CloseConnectionReason closeConnectionReason, Connection connection) {
return closeConnectionReason == CloseConnectionReason.PEER_BANNED &&
connection.getPeersNodeAddressOptional().isPresent();
}
private void maybeRemoveBannedPeer(CloseConnectionReason closeConnectionReason, Connection connection) {
if (connection.getPeersNodeAddressOptional().isPresent() && isNodeBanned(closeConnectionReason, connection)) {
if (connection.getPeersNodeAddressOptional().isPresent() && isPeerBanned(closeConnectionReason, connection)) {
NodeAddress nodeAddress = connection.getPeersNodeAddressOptional().get();
seedNodeAddresses.remove(nodeAddress);
removePersistedPeer(nodeAddress);

View File

@ -210,8 +210,8 @@ public class RequestDataManager implements MessageListener, ConnectionListener,
public void onDisconnect(CloseConnectionReason closeConnectionReason, Connection connection) {
closeHandler(connection);
if (peerManager.isNodeBanned(closeConnectionReason, connection) && connection.getPeersNodeAddressOptional().isPresent()) {
final NodeAddress nodeAddress = connection.getPeersNodeAddressOptional().get();
if (peerManager.isPeerBanned(closeConnectionReason, connection) && connection.getPeersNodeAddressOptional().isPresent()) {
NodeAddress nodeAddress = connection.getPeersNodeAddressOptional().get();
seedNodeAddresses.remove(nodeAddress);
handlerMap.remove(nodeAddress);
}

View File

@ -147,7 +147,7 @@ public class PeerExchangeManager implements MessageListener, ConnectionListener,
}, RETRY_DELAY_SEC);
}
if (peerManager.isNodeBanned(closeConnectionReason, connection))
if (peerManager.isPeerBanned(closeConnectionReason, connection))
seedNodeAddresses.remove(connection.getPeersNodeAddressOptional().get());
}