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

Socket leaks on async connect failure #9

Open
dholroyd opened this issue Jan 4, 2022 · 1 comment
Open

Socket leaks on async connect failure #9

dholroyd opened this issue Jan 4, 2022 · 1 comment

Comments

@dholroyd
Copy link

dholroyd commented Jan 4, 2022

I've had long-running applications run out of file descriptors and while debugging noticed that srt-rs will leak a socket if async connect fails.

I worked around that by implementing Drop for ConnectFuture in dholroyd@5e6adce

I can submit that as a PR if the approach is good. I had originally planned to implement Drop for SrtSocket, but that looked much more difficult due to lots of existing usage needing it to be Copy.

@nthieu173
Copy link
Owner

The ConnectFuture move out of scope and gets dropped once it returns a successful SrtAsyncStream. So this approach will close a socket while it's still in use. Instead, I think closing it once there is an error in poll() is a better approach.

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

2 participants