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

Very slow shutdown when connection attempt running #98

Open
viniciusfbb opened this issue Apr 6, 2021 · 0 comments
Open

Very slow shutdown when connection attempt running #98

viniciusfbb opened this issue Apr 6, 2021 · 0 comments

Comments

@viniciusfbb
Copy link
Contributor

Using the cross-socket on the client-side, I noticed that the shutdown (StopLoop) hangs for several seconds when there is at least 1 connection attempt running.

This is because the sockets that are trying to connect do not receive the TSocketAPI.CloseSocket in StopLoop, because it is not yet in the list of FConnections, which will only be added after a successful connection, but not during attempts. So basically StopLoop is waiting for the timeout of this connection attempt to finish completely (and this can be several seconds).

My tests were done only at IOCP, so I don't know if the same problem occurs on Epoll or Kqueue.

There are several solutions to this, one of which would be to add the sockets created in Connect to an FConnectionsAttempt list and remove them at the end of the attempt and then override CloseAll to add the TSocketAPI.CloseSocket to each socket of FConnectionsAttempt.

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