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

chore: Split requests into their own sessiosn #172

Merged
merged 33 commits into from
Apr 12, 2024

Conversation

dariusc93
Copy link
Owner

Previously, we were processing the bitswap request in a single stream per peer, however while this method worked fine, we had issues when it comes to a large number of peers and conflicting requests, likely considered as a race when receiving a request and processing it in the stream while it is also later cancelled.

This PR solves this issue by splitting the stream into two streams, with each handling their own respective requests for that session. This allows us to add, remove, and change the state of each session.

Note:

  • This change does remove sending multiple requests in a single message since each cid is processed in its own session, however this may change in the future where we can have a general session state that could collectively send multiple requests (and maybe multiple blocks) in a single message.

@dariusc93 dariusc93 marked this pull request as ready for review April 12, 2024 07:02
@dariusc93 dariusc93 merged commit 72e6aaf into libp2p-next Apr 12, 2024
@dariusc93 dariusc93 deleted the chore/bitswap-opt-r1 branch April 12, 2024 07:02
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

1 participant