-
Notifications
You must be signed in to change notification settings - Fork 112
refactor: simplify messageQueue onSent #349
Conversation
mq.bcstWants.MarkSent(bcstEntries[i]) | ||
} | ||
for i := 0; i < peerSentCount; i++ { | ||
mq.peerWants.MarkSent(peerEntries[i]) |
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.
This won't quite work as we will have removed some of the peer wants to peers that don't support HAVE.
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.
We remove them when we realize the peer doesn't support HAVE, so in MarkSent()
we could just check if they've already been removed from pending before adding them to sent.
But actually I think it's clearer to put them in a list. I pushed a commit with this change.
@@ -566,6 +566,7 @@ func (mq *MessageQueue) extractOutgoingMessage(supportsHave bool) (bsmsg.BitSwap | |||
} | |||
|
|||
// Add each regular want-have / want-block to the message | |||
peerSent := make([]wantlist.Entry, 0, len(peerEntries)) |
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.
nit: we can actually reuse the original slice if we do this correctly. But this is a low priority as I'm pretty sure we're going to delete this code when we land #347.
…-onSent refactor: simplify messageQueue onSent This commit was moved from ipfs/go-bitswap@6099047
No description provided.