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: reliable key exchange #27

Merged
merged 1 commit into from
Nov 11, 2018
Merged

fix: reliable key exchange #27

merged 1 commit into from
Nov 11, 2018

Conversation

hackergrrl
Copy link
Member

This fixes a race condition where the key and other multifeed data could end up
being read together (one big buffer vs multiple smaller buffer).

@hackergrrl
Copy link
Member Author

hackergrrl commented Nov 11, 2018

This covers the race condition case where

  1. I send you my key, and you send me yours
  2. I receive yours, and begin multifeed replication, which means sending the multifeed header
  3. this maybe happened quite fast on my end, so my kernel decides to collate my key and the multifeed header together, and send both as one packet over the network
  4. the data event fires, and the buffer has the remote key and some/all of the multifeed header, resulting in either a bad handshake or the multifeed header being discarded

@hackergrrl hackergrrl merged commit d86abcb into master Nov 11, 2018
@cblgh cblgh deleted the fix-handshake branch April 18, 2020 11:27
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.

1 participant