Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

fix: use unidirectional streams #45

Merged
merged 1 commit into from
Jun 4, 2020

Conversation

vasco-santos
Copy link
Member

@vasco-santos vasco-santos commented Jun 3, 2020

This PR makes libp2p pubsub subsystem use unidirectional streams instead of bidirectional streams per discussion on ipfs/go-ipfs#7390.

More details about the reasoning for this can be found in https://discuss.libp2p.io/t/gossip-questions/257/6

@vasco-santos
Copy link
Member Author

Per ipfs/kubo#7390 (comment) this should be ready to go

@@ -87,6 +87,8 @@ class Peer extends EventEmitter {
this.conn = conn
this.stream = pushable({
onEnd: () => {
// close readable side of the stream
this.conn.reset && this.conn.reset()
Copy link
Member Author

Choose a reason for hiding this comment

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

As a follow-up, I will create an issue to remove this validation and create a wrapper around it-pair for these tests.

it-pair provides a bare minimal duplex stream for testing, but it does not have the reset function, as a multiplex stream. I tested this with js-libp2p and the stream reset function is called there.

@vasco-santos vasco-santos merged commit c6ba48d into master Jun 4, 2020
@vasco-santos vasco-santos deleted the fix/use-unidirectional-streams branch June 4, 2020 08:06
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