From 13d355657bc492a627db7ed863c69c27132a9491 Mon Sep 17 00:00:00 2001 From: vyzo Date: Thu, 1 Apr 2021 12:16:06 +0300 Subject: [PATCH] add comment about the necessity of removing the address tracking when a dial backoff occurs --- swarm_dial.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/swarm_dial.go b/swarm_dial.go index ab95a46..29e3a8d 100644 --- a/swarm_dial.go +++ b/swarm_dial.go @@ -356,7 +356,12 @@ func (s *Swarm) dialWorkerLoop(ctx context.Context, p peer.ID, reqch <-chan dial ad.requests = nil - // if it was a backoff, clear the address dial so that it doesn't inhibit new dial requests + // if it was a backoff, clear the address dial so that it doesn't inhibit new dial requests. + // this is necessary to support active listen scenarios, where a new dial comes in while + // another dial is in progress, and needs to do a direct connection without inhibitions from + // dial backoff. + // it is also necessary to preserve consisent behaviour with the old dialer -- TestDialBackoff + // regresses without this. if err == ErrDialBackoff { delete(pending, ad.addr) } -- GitLab