Skip to content
This repository has been archived by the owner on Feb 24, 2021. It is now read-only.

refactor secio handshake #25

Merged
merged 4 commits into from
Dec 15, 2017
Merged

refactor secio handshake #25

merged 4 commits into from
Dec 15, 2017

Conversation

Stebalien
Copy link
Member

@Stebalien Stebalien commented Dec 15, 2017

  1. Respect context. Before, we didn't respect the context when writing/reading the final nonce.
  2. Don't make assumptions about connection buffering. Read/write handshake messages in parallel.
  3. Return messages from ReadMsg to the buffer pool.
  4. Close the connection on timeout. We can't reuse it at this point as there may be an outstanding writer/reader (and we don't allow parallel reads/writes).
  5. Make sure that ephemeral key generation actually succeeds.

Testing: The tests in go-libp2p-swarm and go-libp2p-conn still pass (and they're much more comprehensive than the ones here).

1. Respect context. Before, we didn't respect the context when writing/reading
the final nonce.
2. Don't make assumptions about connection buffering. Read/write handshake
messages in parallel.
3. Return messages from ReadMsg to the buffer pool.
4. Close the connection on timeout. We can't reuse it at this point as there may
be an outstanding writer/reader (and we don't allow parallel reads/writes).
Copy link
Contributor

@whyrusleeping whyrusleeping left a comment

Choose a reason for hiding this comment

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

This LGTM, saves us from spawning new goroutines for each message send. Which I like.

@whyrusleeping
Copy link
Contributor

I still would like to have some more tests here, but all things considered, I'll let it pass this time...

@Stebalien
Copy link
Member Author

@whyrusleeping it only saves us a few (half - 1). I'm still using go routines to read and write a message at the same time.

@Stebalien Stebalien merged commit 326d97c into master Dec 15, 2017
@ghost ghost removed the in progress label Dec 15, 2017
@Stebalien Stebalien deleted the fix/secio-handshake branch December 15, 2017 17:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants