Skip to content
This repository has been archived by the owner on Feb 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #672 from radixdlt/feature/revert-blacklist-on-any…
Browse files Browse the repository at this point in the history
…-failed-connection

Revert peer URI blacklisting on any failed connection
  • Loading branch information
LukasGasior1 authored Apr 20, 2022
2 parents 02707a2 + be590bf commit 30ecb1e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,6 @@ public void channelInactive(ChannelHandlerContext ctx) {
// only send out event if peer was previously active
this.peerEventDispatcher.dispatch(new PeerDisconnected(this));
}

// we initiated connection, but handshake is not completed in time
if (prevState == ChannelState.AUTH_HANDSHAKE && this.isInitiator) {
this.peerEventDispatcher.dispatch(new PeerHandshakeFailed(this));
}
}

private void write(ByteBuf data) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,10 @@ public void should_try_more_than_one_peer_address_to_connect() throws Exception
testNetworkRunner.peerManager(0).findOrCreateChannel(uriOfNode(1).getNodeId());
processAll();

/* still failing but no more connect attempts as URIs got blacklisted previously */
/* still failing with 3 more attempts (no URIs got blacklisted) */
assertTrue(channelFuture2.isCompletedExceptionally());
assertEquals(
3, testNetworkRunner.getInstance(0, TestCounters.class).outboundChannelsBootstrapped);
6, testNetworkRunner.getInstance(0, TestCounters.class).outboundChannelsBootstrapped);

/* add some more invalid URIs and a valid one */
final var invalidUri4 = copyWithPortOffset(validUri, invalidPortOffset + 3);
Expand All @@ -266,7 +266,7 @@ public void should_try_more_than_one_peer_address_to_connect() throws Exception
assertFalse(channelFuture3.isCompletedExceptionally());
final var channelsCounterAtTheEnd =
testNetworkRunner.getInstance(0, TestCounters.class).outboundChannelsBootstrapped;
assertTrue(channelsCounterAtTheEnd >= 4 && channelsCounterAtTheEnd <= 7);
assertTrue(channelsCounterAtTheEnd >= 7 && channelsCounterAtTheEnd <= 10);
}

private RadixNodeUri copyWithPortOffset(RadixNodeUri base, int portOffset) {
Expand Down

0 comments on commit 30ecb1e

Please sign in to comment.