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-unixfs
Commits
a5528c4a
Commit
a5528c4a
authored
Oct 18, 2018
by
hannahhoward
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Force processing of context cancellation first
parent
fa995d36
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
hamt/hamt.go
hamt/hamt.go
+9
-0
No files found.
hamt/hamt.go
View file @
a5528c4a
...
@@ -483,6 +483,15 @@ func makeAsyncTrieGetLinks(dagService ipld.DAGService, linkResults chan<- format
...
@@ -483,6 +483,15 @@ func makeAsyncTrieGetLinks(dagService ipld.DAGService, linkResults chan<- format
}
}
func
emitResult
(
ctx
context
.
Context
,
linkResults
chan
<-
format
.
LinkResult
,
r
format
.
LinkResult
)
{
func
emitResult
(
ctx
context
.
Context
,
linkResults
chan
<-
format
.
LinkResult
,
r
format
.
LinkResult
)
{
// make sure that context cancel is processed first
// the reason is due to the concurrency of EnumerateChildrenAsync
// it's possible for EnumLinksAsync to complete and close the linkResults
// channel before this code runs
select
{
case
<-
ctx
.
Done
()
:
return
default
:
}
select
{
select
{
case
linkResults
<-
r
:
case
linkResults
<-
r
:
case
<-
ctx
.
Done
()
:
case
<-
ctx
.
Done
()
:
...
...
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