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-bitswap
Commits
b78786db
Commit
b78786db
authored
Sep 04, 2016
by
Jeromy Johnson
Committed by
GitHub
Sep 04, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3169 from ipfs/fix/bitswap-goro-leak
bitswap: Don't clear 'active' until Connect calls are finished
parents
a53c0055
1b099641
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
workers.go
workers.go
+4
-0
No files found.
workers.go
View file @
b78786db
...
@@ -209,14 +209,18 @@ func (bs *Bitswap) providerQueryManager(ctx context.Context) {
...
@@ -209,14 +209,18 @@ func (bs *Bitswap) providerQueryManager(ctx context.Context) {
child
,
cancel
:=
context
.
WithTimeout
(
e
.
Ctx
,
providerRequestTimeout
)
child
,
cancel
:=
context
.
WithTimeout
(
e
.
Ctx
,
providerRequestTimeout
)
defer
cancel
()
defer
cancel
()
providers
:=
bs
.
network
.
FindProvidersAsync
(
child
,
e
.
Key
,
maxProvidersPerRequest
)
providers
:=
bs
.
network
.
FindProvidersAsync
(
child
,
e
.
Key
,
maxProvidersPerRequest
)
wg
:=
&
sync
.
WaitGroup
{}
for
p
:=
range
providers
{
for
p
:=
range
providers
{
wg
.
Add
(
1
)
go
func
(
p
peer
.
ID
)
{
go
func
(
p
peer
.
ID
)
{
defer
wg
.
Done
()
err
:=
bs
.
network
.
ConnectTo
(
child
,
p
)
err
:=
bs
.
network
.
ConnectTo
(
child
,
p
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Debug
(
"failed to connect to provider %s: %s"
,
p
,
err
)
log
.
Debug
(
"failed to connect to provider %s: %s"
,
p
,
err
)
}
}
}(
p
)
}(
p
)
}
}
wg
.
Wait
()
activeLk
.
Lock
()
activeLk
.
Lock
()
kset
.
Remove
(
e
.
Key
)
kset
.
Remove
(
e
.
Key
)
activeLk
.
Unlock
()
activeLk
.
Unlock
()
...
...
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