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

Client can be dropped while port is open #8

Open
Boddlnagg opened this issue Jul 18, 2017 · 1 comment
Open

Client can be dropped while port is open #8

Boddlnagg opened this issue Jul 18, 2017 · 1 comment

Comments

@Boddlnagg
Copy link
Contributor

Boddlnagg commented Jul 18, 2017

Currently it is possible (and may happen by accident) that a Client is dropped, while a port or virtual endpoint is still open.

If the port is an output, you can still send to the output without an error, but no message is actually sent. Similarly, if the port is an input, you just won't receive any messages.

I don't think that this is a memory safety issue, but it might be a source of surprising behavior. The fix would be to couple the lifetimes of ports to the Client, though this makes the API slightly more complicated.

@chris-zen
Copy link
Owner

Hi @Boddlnagg, thanks for the heads up. I have spent 10 minutes thinking on that, and I have to recognise that the solution with lifetimes, and the actual implications on the user side for this change, go beyond my current understanding of lifetimes and the borrow checker.
I haven't been able to spend much time on rust during the last year, but I'll keep it in mind the next time I revisit the corresponding chapters from the Rust book.

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 a pull request may close this issue.

2 participants