-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bitswap sessions #3867
Bitswap sessions #3867
Changes from all commits
47479b6
bda8c3a
e43d131
b680f49
b1247d3
579fd46
1ffb44c
eab2024
124afdb
3be5c91
dd7589b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,7 +64,11 @@ var unwantCmd = &cmds.Command{ | |
ks = append(ks, c) | ||
} | ||
|
||
bs.CancelWants(ks) | ||
// TODO: This should maybe find *all* sessions for this request and cancel them? | ||
// (why): in reality, i think this command should be removed. Its | ||
// messing with the internal state of bitswap. You should cancel wants | ||
// by killing the command that caused the want. | ||
bs.CancelWants(ks, 0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does canceling the context not cancel the associated wants? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, cancelling the context of any request command cancels the associated wants. So this command really should just get removed, it has no real purpose |
||
}, | ||
} | ||
|
||
|
@@ -107,6 +111,11 @@ Print out all blocks currently on the bitswap wantlist for the local peer.`, | |
res.SetError(err, cmds.ErrNormal) | ||
return | ||
} | ||
if pid == nd.Identity { | ||
res.SetOutput(&KeyList{bs.GetWantlist()}) | ||
return | ||
} | ||
|
||
res.SetOutput(&KeyList{bs.WantlistForPeer(pid)}) | ||
} else { | ||
res.SetOutput(&KeyList{bs.GetWantlist()}) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed, can't we just pass
s.exchange
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope, because then the response wouldnt be
nil
(it would be a typed nil, which in interface form is != nil)