Skip to content

Commit

Permalink
Disconnect timed out connects (#6594)
Browse files Browse the repository at this point in the history
  • Loading branch information
benaadams authored Jan 23, 2024
1 parent 7a40043 commit 8191870
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Nethermind/Nethermind.Network/Rlpx/RlpxHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,15 @@ public async Task ConnectAsync(Node node)
if (firstTask != connectTask)
{
if (_logger.IsTrace) _logger.Trace($"|NetworkTrace| {node:s} OUT connection timed out");

_ = connectTask.ContinueWith(async c =>
{
if (connectTask.IsCompletedSuccessfully)
{
await c.Result.DisconnectAsync();
}
});

throw new NetworkingException($"Failed to connect to {node:s} (timeout)", NetworkExceptionType.Timeout);
}

Expand Down

0 comments on commit 8191870

Please sign in to comment.