mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Refactor: Rename method
This commit is contained in:
parent
ed960aba3f
commit
0686079946
@ -180,7 +180,7 @@ public class LiteNodeNetworkService implements MessageListener, ConnectionListen
|
|||||||
public void onDisconnect(CloseConnectionReason closeConnectionReason, Connection connection) {
|
public void onDisconnect(CloseConnectionReason closeConnectionReason, Connection connection) {
|
||||||
closeHandler(connection);
|
closeHandler(connection);
|
||||||
|
|
||||||
if (peerManager.isNodeBanned(closeConnectionReason, connection)) {
|
if (peerManager.isPeerBanned(closeConnectionReason, connection)) {
|
||||||
connection.getPeersNodeAddressOptional().ifPresent(nodeAddress -> {
|
connection.getPeersNodeAddressOptional().ifPresent(nodeAddress -> {
|
||||||
seedNodeAddresses.remove(nodeAddress);
|
seedNodeAddresses.remove(nodeAddress);
|
||||||
removeFromRequestBlocksHandlerMap(nodeAddress);
|
removeFromRequestBlocksHandlerMap(nodeAddress);
|
||||||
|
@ -287,14 +287,13 @@ public final class PeerManager implements ConnectionListener, PersistedDataHost
|
|||||||
return seedNodeAddresses.contains(nodeAddress);
|
return seedNodeAddresses.contains(nodeAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO rename
|
public boolean isPeerBanned(CloseConnectionReason closeConnectionReason, Connection connection) {
|
||||||
public boolean isNodeBanned(CloseConnectionReason closeConnectionReason, Connection connection) {
|
|
||||||
return closeConnectionReason == CloseConnectionReason.PEER_BANNED &&
|
return closeConnectionReason == CloseConnectionReason.PEER_BANNED &&
|
||||||
connection.getPeersNodeAddressOptional().isPresent();
|
connection.getPeersNodeAddressOptional().isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void maybeRemoveBannedPeer(CloseConnectionReason closeConnectionReason, Connection connection) {
|
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();
|
NodeAddress nodeAddress = connection.getPeersNodeAddressOptional().get();
|
||||||
seedNodeAddresses.remove(nodeAddress);
|
seedNodeAddresses.remove(nodeAddress);
|
||||||
removePersistedPeer(nodeAddress);
|
removePersistedPeer(nodeAddress);
|
||||||
|
@ -210,8 +210,8 @@ public class RequestDataManager implements MessageListener, ConnectionListener,
|
|||||||
public void onDisconnect(CloseConnectionReason closeConnectionReason, Connection connection) {
|
public void onDisconnect(CloseConnectionReason closeConnectionReason, Connection connection) {
|
||||||
closeHandler(connection);
|
closeHandler(connection);
|
||||||
|
|
||||||
if (peerManager.isNodeBanned(closeConnectionReason, connection) && connection.getPeersNodeAddressOptional().isPresent()) {
|
if (peerManager.isPeerBanned(closeConnectionReason, connection) && connection.getPeersNodeAddressOptional().isPresent()) {
|
||||||
final NodeAddress nodeAddress = connection.getPeersNodeAddressOptional().get();
|
NodeAddress nodeAddress = connection.getPeersNodeAddressOptional().get();
|
||||||
seedNodeAddresses.remove(nodeAddress);
|
seedNodeAddresses.remove(nodeAddress);
|
||||||
handlerMap.remove(nodeAddress);
|
handlerMap.remove(nodeAddress);
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ public class PeerExchangeManager implements MessageListener, ConnectionListener,
|
|||||||
}, RETRY_DELAY_SEC);
|
}, RETRY_DELAY_SEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (peerManager.isNodeBanned(closeConnectionReason, connection))
|
if (peerManager.isPeerBanned(closeConnectionReason, connection))
|
||||||
seedNodeAddresses.remove(connection.getPeersNodeAddressOptional().get());
|
seedNodeAddresses.remove(connection.getPeersNodeAddressOptional().get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user