Skip to content

Commit

Permalink
P2PNodesManager: Use ConnectedNodesCount everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
kiminuo committed Jan 22, 2024
1 parent 47eb687 commit df095cc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions WalletWasabi/Wallets/P2PNodesManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public P2PNodesManager(Network network, NodesGroup nodes, bool isTorEnabled)

public async Task<Node?> GetNodeAsync(CancellationToken cancellationToken)
{
while (Nodes.ConnectedNodes.Count == 0)
while (ConnectedNodesCount == 0)
{
await Task.Delay(100, cancellationToken).ConfigureAwait(false);
}
Expand All @@ -37,7 +37,7 @@ public P2PNodesManager(Network network, NodesGroup nodes, bool isTorEnabled)

public void DisconnectNodeIfEnoughPeers(Node node, string reason)
{
if (Nodes.ConnectedNodes.Count > 3)
if (ConnectedNodesCount > 3)
{
Logger.LogInfo(reason);
DisconnectNode(node, reason);
Expand All @@ -52,7 +52,7 @@ public void DisconnectNode(Node node, string reason)
public double GetCurrentTimeout()
{
// More permissive timeout if few nodes are connected to avoid exhaustion.
return Nodes.ConnectedNodes.Count < 3
return ConnectedNodesCount < 3
? Math.Min(RuntimeParams.Instance.NetworkNodeTimeout * 1.5, 600)
: RuntimeParams.Instance.NetworkNodeTimeout;
}
Expand Down

0 comments on commit df095cc

Please sign in to comment.