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

Question: Is the Sender safe to use after it returned an error? #58

Closed
hrxi opened this issue Mar 29, 2022 · 1 comment
Closed

Question: Is the Sender safe to use after it returned an error? #58

hrxi opened this issue Mar 29, 2022 · 1 comment

Comments

@hrxi
Copy link

hrxi commented Mar 29, 2022

In trying to solve libp2p/rust-libp2p#2598, it'd be interesting to know whether one can safely continue using a Sender after it returned an error from send_binary_mut, send_ping or send_pong.

@hrxi
Copy link
Author

hrxi commented Mar 30, 2022

Doesn't look like it, the relevant functions use write_all, which cannot track how far it got before an error was returned:

w.write_all(&header_bytes).await.or(Err(Error::Closed))?;

@hrxi hrxi closed this as completed Mar 30, 2022
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

No branches or pull requests

1 participant