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

[ping] Add missing flush after write. #1770

Merged
merged 1 commit into from
Sep 28, 2020
Merged

Conversation

romanb
Copy link
Contributor

@romanb romanb commented Sep 22, 2020

After sending the ping and before awaiting the pong, the stream must be flushed to guarantee the data is sent before awaiting the reply. This is not necessary with libp2p-yamux where every sent frame is flushed, but with mplex it may remain sitting in a buffer otherwise. This problem was revealed by #1758 together with some other mplex issues addressed in #1769. This PR is on top of #1769 since the tests randomise usage of mplex and yamux and only pass consistently with these patches. For a proper diff (it is small), see here.

Together with #1769, closes #1758.

Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

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

18711c5 looks good to me. I will look into #1769.

After sending the ping and before awaiting the pong,
the stream must be flushed to guarantee the data is
sent before awaiting the reply.
@romanb romanb merged commit f66f40b into libp2p:master Sep 28, 2020
@romanb romanb deleted the ping-mplex branch September 28, 2020 08:57
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.

Ping protocol tests fail when mplex is used instead of yamux.
2 participants