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
dms3
go-dms3
Commits
016b0053
Commit
016b0053
authored
Nov 21, 2017
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix goroutine leaks in DHT commands
License: MIT Signed-off-by:
Steven Allen
<
steven@stebalien.com
>
parent
b18b1e90
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
6 deletions
+29
-6
core/commands/dht.go
core/commands/dht.go
+29
-6
No files found.
core/commands/dht.go
View file @
016b0053
...
...
@@ -93,7 +93,11 @@ var queryDhtCmd = &cmds.Command{
go
func
()
{
defer
close
(
outChan
)
for
e
:=
range
events
{
outChan
<-
e
select
{
case
outChan
<-
e
:
case
<-
req
.
Context
()
.
Done
()
:
return
}
}
}()
},
...
...
@@ -181,7 +185,11 @@ var findProvidersDhtCmd = &cmds.Command{
go
func
()
{
defer
close
(
outChan
)
for
e
:=
range
events
{
outChan
<-
e
select
{
case
outChan
<-
e
:
case
<-
req
.
Context
()
.
Done
()
:
return
}
}
}()
...
...
@@ -301,7 +309,11 @@ var provideRefDhtCmd = &cmds.Command{
go
func
()
{
defer
close
(
outChan
)
for
e
:=
range
events
{
outChan
<-
e
select
{
case
outChan
<-
e
:
case
<-
req
.
Context
()
.
Done
()
:
return
}
}
}()
...
...
@@ -427,7 +439,11 @@ var findPeerDhtCmd = &cmds.Command{
go
func
()
{
defer
close
(
outChan
)
for
v
:=
range
events
{
outChan
<-
v
select
{
case
outChan
<-
v
:
case
<-
req
.
Context
()
.
Done
()
:
}
}
}()
...
...
@@ -529,7 +545,10 @@ Different key types can specify other 'best' rules.
go
func
()
{
defer
close
(
outChan
)
for
e
:=
range
events
{
outChan
<-
e
select
{
case
outChan
<-
e
:
case
<-
req
.
Context
()
.
Done
()
:
}
}
}()
...
...
@@ -643,7 +662,11 @@ NOTE: A value may not exceed 2048 bytes.
go
func
()
{
defer
close
(
outChan
)
for
e
:=
range
events
{
outChan
<-
e
select
{
case
outChan
<-
e
:
case
<-
req
.
Context
()
.
Done
()
:
return
}
}
}()
...
...
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