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-kad-dht
Commits
8bacc6cd
Commit
8bacc6cd
authored
Feb 19, 2019
by
Raúl Kripalani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dialqueue: fix possible worker goroutine leak.
parent
52b75ddd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
dial_queue.go
dial_queue.go
+8
-1
No files found.
dial_queue.go
View file @
8bacc6cd
...
...
@@ -323,7 +323,14 @@ func (dq *dialQueue) worker() {
}
logger
.
Debugf
(
"dialling %v took %dms (as observed by the dht subsystem)."
,
p
,
time
.
Since
(
t
)
/
time
.
Millisecond
)
waiting
:=
len
(
dq
.
waitingCh
)
dq
.
out
.
EnqChan
<-
p
// by the time we're done dialling, it's possible that the context is closed, in which case there will
// be nobody listening on dq.out.EnqChan and we could block forever.
select
{
case
dq
.
out
.
EnqChan
<-
p
:
case
<-
dq
.
ctx
.
Done
()
:
return
}
if
waiting
>
0
{
// we have somebody to deliver this value to, so no need to shrink.
continue
...
...
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