Skip to content
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

fix(bitswap.decision.Engine) send only the freshest messages #601

Merged
merged 2 commits into from Jan 20, 2015

Conversation

btc
Copy link
Contributor

@btc btc commented Jan 19, 2015

Bitswap prioritizes sending of blocks using a PQ. A decision engine worker
pops tasks off the queue and gives bitswap packaged messages to be sent
to partners.

Before, the engine worker would pop a task and block on send to the
bitswap worker even if the bitswap worker wasn't to receive. Since the
task could have been invalidated during that blocking send, a small
number of stale (already acquired) blocks were sent to partners.

Now, tasks are only popped off of the queue when bitswap is ready to
send them over the wire. This is accomplished by removing the
outboxChanBuffer and implementing a two-phase communication sequence.

@btc btc added the status/in-progress In progress label Jan 19, 2015
close(oneTimeUse)
return // ctx cancelled
}
oneTimeUse <- *envelope // buffered. won't block
Copy link
Member

Choose a reason for hiding this comment

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

personally, I would make the oneTimeUse be a chan *Envelope just to avoid a dereference, looks cleaner that way IMO

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Brian Tiger Chow added 2 commits January 19, 2015 03:07
Before, the engine worker would pop a task and block on send to the
bitswap worker even if the bitswap worker wasn't to receive. Since the
task could have been invalidated during this blocking send, a small
number of stale (already acquired) blocks would be send to partners.

Now, tasks are only popped off of the queue when bitswap is ready to
send them over the wire. This is accomplished by removing the
outboxChanBuffer and implementing a two-phase communication sequence.
@btc btc force-pushed the fix/bitswap-decision-engine-freshness branch from 8470698 to 5985854 Compare January 19, 2015 11:08
@jbenet
Copy link
Member

jbenet commented Jan 19, 2015

This LGTM, but deferring to @whyrusleeping

@whyrusleeping
Copy link
Member

This LGTM too.

@whyrusleeping whyrusleeping added this to the α milestone Jan 19, 2015
btc pushed a commit that referenced this pull request Jan 20, 2015
…ness

fix(bitswap.decision.Engine) send only the freshest messages
@btc btc merged commit 7a322c9 into master Jan 20, 2015
@btc btc removed the status/in-progress In progress label Jan 20, 2015
@btc btc deleted the fix/bitswap-decision-engine-freshness branch January 20, 2015 04:45
@btc
Copy link
Contributor Author

btc commented Jan 20, 2015

thanks guys

@Stebalien Stebalien mentioned this pull request May 26, 2020
77 tasks
ariescodescream pushed a commit to ariescodescream/go-ipfs that referenced this pull request Oct 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants