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
b08e0f55
Commit
b08e0f55
authored
Feb 26, 2019
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(prq): return a closed channel when encountering a canceled context
Otherwise, we'll wait forever.
parent
ee93aa83
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
providerquerymanager/providerquerymanager.go
providerquerymanager/providerquerymanager.go
+12
-4
No files found.
providerquerymanager/providerquerymanager.go
View file @
b08e0f55
...
...
@@ -124,17 +124,25 @@ func (pqm *ProviderQueryManager) FindProvidersAsync(sessionCtx context.Context,
inProgressRequestChan
:
inProgressRequestChan
,
}
:
case
<-
pqm
.
ctx
.
Done
()
:
return
nil
ch
:=
make
(
chan
peer
.
ID
)
close
(
ch
)
return
ch
case
<-
sessionCtx
.
Done
()
:
return
nil
ch
:=
make
(
chan
peer
.
ID
)
close
(
ch
)
return
ch
}
var
receivedInProgressRequest
inProgressRequest
select
{
case
<-
pqm
.
ctx
.
Done
()
:
return
nil
ch
:=
make
(
chan
peer
.
ID
)
close
(
ch
)
return
ch
case
<-
sessionCtx
.
Done
()
:
return
nil
ch
:=
make
(
chan
peer
.
ID
)
close
(
ch
)
return
ch
case
receivedInProgressRequest
=
<-
inProgressRequestChan
:
}
...
...
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