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: close stream after sending identify #1424

Merged
merged 2 commits into from Oct 14, 2022

Conversation

MarcoPolo
Copy link
Contributor

Close the stream after we finish writing the identify message. This is behavior is specified https://github.com/libp2p/specs/blob/master/identify/README.md#identify

The peer being identified responds by returning an Identify message and closes the stream.

This shows up when interacting with a go-libp2p node as go-libp2p waits for the stream to close before finishing reading the messages: https://github.com/libp2p/go-libp2p/blob/master/p2p/protocol/identify/id.go#L455.

@MarcoPolo
Copy link
Contributor Author

bit more context, this is particularly bad when interacting with go-libp2p nodes as go-libp2p will wait for identify to finish before continuing other protocols. So we are blocked until the identify timeout happens before we can do anything else when interacting a js-libp2p node with a go-libp2p node.

For why go does this multi-message merge, see: libp2p/go-libp2p#954 (comment)

@achingbrain achingbrain changed the title Close stream after sending identify fix: close stream after sending identify Oct 14, 2022
@achingbrain achingbrain merged commit a74d22a into master Oct 14, 2022
@achingbrain achingbrain deleted the marco/close-stream-after-sending-identify branch October 14, 2022 13:16
@achingbrain
Copy link
Member

Good catch, thanks!

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

2 participants