-
Notifications
You must be signed in to change notification settings - Fork 112
Fix: don't ignore received blocks for pending wants #174
Conversation
One concern with this approach is that we ask each session in turn if it is interested in the CID. If there are Lines 144 to 172 in e72b289
One option would be to simply replace the |
We're going to have to check this anyways when we figure out where to send the blocks. However, it's slightly worse in this case as we'll need to call this on duplicates as well. I'd like to drop the interest cache and provide a way to check this without using channels anyways so I'm all for fixing this. To handle, the many sessions issue, we could even have a second, global & reference counted interest set. I believe we'll still have races where we'll receive multiple blocks quickly before we record that we've received them but I believe that's a problem anyways. |
I guess the most important property is that if The session stores all the CIDs it has ever been asked for in We just need to make sure we take a lock each time we manipulate or query any of those sets of CIDs. |
I created a PR #184 that branches off this PR, to explore refactoring want management into a separate class, so that it's easier to put locks around the want queues. With locks in place we can avoid going through Session's event loop when calling EDIT: I merged the want management PR into this PR. Now it just puts want management behind locks |
3e5e09c
to
526e553
Compare
Tests are failing because of some flakiness that is fixed in #185 |
3f85389
to
7458eb8
Compare
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.
Nits you can ignore (or not). But this really does feel simpler
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.
My only real comment is on the goroutines. I'd leave those out (unless you feel that there's a strong need for them).
|
||
s.sw.RUnlock() | ||
// Record unique vs duplicate blocks | ||
s.sw.ForEachUniqDup(rcv.ks, s.srs.RecordUniqueBlock, s.srs.RecordDuplicateBlock) |
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.
Hm. I'm not sure of a better way to do this but this is a bit funky. But it's probably fine.
…ing-blocks Fix: don't ignore received blocks for pending wants This commit was moved from ipfs/go-bitswap@7944a99
Fixes #172