Skip to content
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.

fix: in message queue only send cancel if want was sent #345

Merged
merged 1 commit into from
Apr 11, 2020

Conversation

dirkmc
Copy link
Contributor

@dirkmc dirkmc commented Apr 10, 2020

No description provided.

@dirkmc dirkmc requested a review from Stebalien April 10, 2020 18:15
Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some nits and comments, but they can be addressed later.

@@ -79,6 +87,7 @@ func (swl *SessionWantlist) Keys() []cid.Cid {
return ks
}

// All sessions that want the given keys
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Should be of the form:

SessionsFor returns all sessions that want the given keys.

(same for the others)

r.pending.RemoveType(c, wtype)
}

// Sent moves the want from the pending to the sent list
func (r *recallWantlist) Sent(e bsmsg.Entry) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: MarkSent is the action.

// Called when the message has been successfully sent.
onMessageSent := func(wantlist []bsmsg.Entry) {
bcst := keysToSet(bcstEntries)
prws := keysToSet(peerEntries)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably going to show up on profiles, but we can wait and see.

@Stebalien Stebalien merged commit 6728add into master Apr 11, 2020
@Stebalien Stebalien deleted the fix/cancel-leak branch April 11, 2020 00:24
@Stebalien Stebalien restored the fix/cancel-leak branch April 11, 2020 00:34
mq.bcstWants.pending.Remove(e.Cid)
mq.peerWants.pending.RemoveType(e.Cid, e.WantType)
// Move the keys from pending to sent
for _, e := range wantlist {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume we do it this way so we only move things that we actually sent? Given that, we might as well pre-compute that list instead of passing the wantlist back in.

Jorropo pushed a commit to Jorropo/go-libipfs that referenced this pull request Jan 26, 2023
fix: in message queue only send cancel if want was sent

This commit was moved from ipfs/go-bitswap@6728add
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants