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
33c82070
Unverified
Commit
33c82070
authored
Nov 21, 2017
by
Whyrusleeping
Committed by
GitHub
Nov 21, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4407 from ipfs/fix/4394
fix deadlock in bitswap sessions
parents
586dd656
a94755db
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
exchange/bitswap/session.go
exchange/bitswap/session.go
+10
-2
No files found.
exchange/bitswap/session.go
View file @
33c82070
...
...
@@ -120,9 +120,13 @@ type interestReq struct {
// still be in the interest cache.
func
(
s
*
Session
)
isLiveWant
(
c
*
cid
.
Cid
)
bool
{
resp
:=
make
(
chan
bool
,
1
)
s
.
interestReqs
<-
interestReq
{
select
{
case
s
.
interestReqs
<-
interestReq
{
c
:
c
,
resp
:
resp
,
}
:
case
<-
s
.
ctx
.
Done
()
:
return
false
}
select
{
...
...
@@ -278,13 +282,17 @@ func (s *Session) cancel(keys []*cid.Cid) {
}
func
(
s
*
Session
)
cancelWants
(
keys
[]
*
cid
.
Cid
)
{
s
.
cancelKeys
<-
keys
select
{
case
s
.
cancelKeys
<-
keys
:
case
<-
s
.
ctx
.
Done
()
:
}
}
func
(
s
*
Session
)
fetch
(
ctx
context
.
Context
,
keys
[]
*
cid
.
Cid
)
{
select
{
case
s
.
newReqs
<-
keys
:
case
<-
ctx
.
Done
()
:
case
<-
s
.
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