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

Sender::send polls forever if channel is disconnected. #880

Closed
maffoo opened this issue Sep 21, 2020 · 3 comments
Closed

Sender::send polls forever if channel is disconnected. #880

maffoo opened this issue Sep 21, 2020 · 3 comments

Comments

@maffoo
Copy link

maffoo commented Sep 21, 2020

Receiver::recv fails with a RecvError if the channel is disconnected, but Sender::send will just spin forever in that case with a future that is always pending. I'd like to have a send method that keeps trying if the channel is full but fails with a SendError if the channel disconnects. This could be a new method, something like Sender::send_if_connected.

@maffoo
Copy link
Author

maffoo commented Sep 21, 2020

Instead of adding a new method (or perhaps in addition) it might be nice to change the behavior of the existing send method to finish immediately and drop messages if the channel is disconnected. It is already the case that messages could be added to the channel buffer and then dropped when the channel is disconnected, so send completing is no guarantee that messages will be received.

@yoshuawuyts
Copy link
Contributor

I think this is closed by #827 which adds a new channel impl.

@Fishrock123
Copy link
Member

(Closing, we can re-open if it isn't.)

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

3 participants