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
f7c26f49
Unverified
Commit
f7c26f49
authored
Jan 04, 2018
by
Whyrusleeping
Committed by
GitHub
Jan 04, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #51 from libp2p/fix/clear-cancelled-dials
clear out extra dial jobs after dial finishes
parents
632ac482
2c697baf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
limiter.go
limiter.go
+9
-0
swarm_dial.go
swarm_dial.go
+2
-0
No files found.
limiter.go
View file @
f7c26f49
...
...
@@ -144,6 +144,15 @@ func (dl *dialLimiter) AddDialJob(dj *dialJob) {
go
dl
.
executeDial
(
dj
)
}
func
(
dl
*
dialLimiter
)
clearAllPeerDials
(
p
peer
.
ID
)
{
dl
.
rllock
.
Lock
()
defer
dl
.
rllock
.
Unlock
()
delete
(
dl
.
waitingOnPeerLimit
,
p
)
// NB: the waitingOnFd list doesnt need to be cleaned out here, we will
// remove them as we encounter them because they are 'cancelled' at this
// point
}
// executeDial calls the dialFunc, and reports the result through the response
// channel when finished. Once the response is sent it also releases all tokens
// it held during the dial.
...
...
swarm_dial.go
View file @
f7c26f49
...
...
@@ -293,6 +293,8 @@ func (s *Swarm) dialAddrs(ctx context.Context, p peer.ID, remoteAddrs <-chan ma.
defaultDialFail
:=
fmt
.
Errorf
(
"failed to dial %s (default failure)"
,
p
)
exitErr
:=
defaultDialFail
defer
s
.
limiter
.
clearAllPeerDials
(
p
)
var
active
int
for
{
select
{
...
...
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