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 yamux remote open #292

Merged
merged 6 commits into from
Jun 9, 2023
Merged

Conversation

ianopolous
Copy link
Contributor

@ianopolous ianopolous commented Jun 2, 2023

Bitswap and identify from kubo, on a connection we initiated, was failing because we were not writing the /multistream/1.0.0 because the send window had not been initialised yet for a remote opened stream in yamux.

We should also tolerate window updates which close a stream and have 0 size (rather than error).

Would also make an excellent candidate unit test.

A connects to B
B opens stream to A
A immediately writes /multistream/1.0.0\n (This must happen during onRemoteOpen)
B does a single write of /multistream/1.0.0\n/ipfs/id/1.0.0\n
A writes /ipfs/id/1.0.0\n
B must receive both writes for success

Don't error on window update for closed stream
stream closes are often window updates with size 0

Make sure window is initialised before calling onRemoteOpen
@ianopolous
Copy link
Contributor Author

Also fixes #291

Copy link
Collaborator

@Nashatyrev Nashatyrev left a comment

Choose a reason for hiding this comment

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

Would be also really nice if you could add a unit test on any regression found and fixed 👍

Comment on lines 78 to 79
onStreamCreate(msg.id) // sometimes writes can happen before onRemoteCreated is called
onRemoteOpen(msg.id)
Copy link
Collaborator

Choose a reason for hiding this comment

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

That would result to onStreamCreate() is called twice.
What's the intention of calling onStreamCreate() explicitly here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The send window needs to be initialized before onRemoteOpen, otherwise it errors and fails to do the first write.

@ianopolous
Copy link
Contributor Author

I was hoping you could help with the unit test, as my Kotlin is not up to scratch (You probably guessed but this is the first Kotlin I've written).

@Nashatyrev
Copy link
Collaborator

@ianopolous please check Peergos#10

Copy link
Collaborator

@Nashatyrev Nashatyrev left a comment

Choose a reason for hiding this comment

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

LGTM when merged Peergos#10

@Nashatyrev Nashatyrev merged commit 3c88678 into libp2p:v1.0.0 Jun 9, 2023
@Nashatyrev Nashatyrev mentioned this pull request Aug 30, 2023
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.

2 participants