Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-p2p-swarm
Commits
b67b7360
Commit
b67b7360
authored
Mar 31, 2021
by
vyzo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
don't add backoff if we have successfully connected
for consistency with the old dialer behaviour.
parent
699b4d11
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
swarm_dial.go
swarm_dial.go
+9
-2
No files found.
swarm_dial.go
View file @
b67b7360
...
...
@@ -368,7 +368,8 @@ func (s *Swarm) dialWorkerLoop(ctx context.Context, p peer.ID, reqch <-chan Dial
var
nextDial
[]
ma
.
Multiaddr
active
:=
0
done
:=
false
done
:=
false
// true when the request channel has been closed
connected
:=
false
// true when a connection has been successfully established
resch
:=
make
(
chan
dialResult
)
...
...
@@ -509,6 +510,10 @@ loop:
case
res
:=
<-
resch
:
active
--
if
res
.
Conn
!=
nil
{
connected
=
true
}
if
done
&&
active
==
0
{
if
res
.
Conn
!=
nil
{
// we got an actual connection, but the dial has been cancelled
...
...
@@ -556,7 +561,9 @@ loop:
}
// it must be an error -- add backoff if applicable and dispatch
if
res
.
Err
!=
context
.
Canceled
{
if
res
.
Err
!=
context
.
Canceled
&&
!
connected
{
// we only add backoff if there has not been a successful connection
// for consistency with the old dialer behavior.
s
.
backf
.
AddBackoff
(
p
,
res
.
Addr
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment