Skip to content

Commit

Permalink
adding debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielmer committed Oct 1, 2024
1 parent d8e6a5c commit 2656819
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions waku/node/peer_manager/peer_manager.nim
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,12 @@ proc connectToRelayPeers*(pm: PeerManager) {.async.} =
var (inRelayPeers, outRelayPeers) = pm.connectedPeers(WakuRelayCodec)
let totalRelayPeers = inRelayPeers.len + outRelayPeers.len

info "connectToRelayPeers",
inRelayPeers = inRelayPeers.len,
inRelayPeersTarget = pm.inRelayPeersTarget,
outRelayPeers = outRelayPeers.len,
outRelayPeersTarget = pm.outRelayPeersTarget

if inRelayPeers.len > pm.inRelayPeersTarget:
await pm.pruneInRelayConns(inRelayPeers.len - pm.inRelayPeersTarget)

Expand All @@ -749,6 +755,8 @@ proc connectToRelayPeers*(pm: PeerManager) {.async.} =
min(outsideBackoffPeers.len, pm.outRelayPeersTarget - outRelayPeers.len)
## number of outstanding connection requests

info "connectToRelayPeers connecting to peers",
numPendingConnReqs = numPendingConnReqs
while numPendingConnReqs > 0 and outRelayPeers.len < pm.outRelayPeersTarget:
let numPeersToConnect = min(numPendingConnReqs, MaxParallelDials)
await pm.connectToNodes(outsideBackoffPeers[index ..< (index + numPeersToConnect)])
Expand All @@ -757,6 +765,12 @@ proc connectToRelayPeers*(pm: PeerManager) {.async.} =

index += numPeersToConnect
numPendingConnReqs -= numPeersToConnect
(inRelayPeers, outRelayPeers) = pm.connectedPeers(WakuRelayCodec)
info "finished connectToRelayPeers",
inRelayPeers = inRelayPeers.len,
inRelayPeersTarget = pm.inRelayPeersTarget,
outRelayPeers = outRelayPeers.len,
outRelayPeersTarget = pm.outRelayPeersTarget

proc manageRelayPeers*(pm: PeerManager) {.async.} =
if pm.wakuMetadata.shards.len == 0:
Expand Down

0 comments on commit 2656819

Please sign in to comment.