-
Notifications
You must be signed in to change notification settings - Fork 62
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
Keep track of used channels and close the connection on stop #69
Keep track of used channels and close the connection on stop #69
Conversation
Thank you again :) A question about the stop method: Shouldn't you await the channels when they are stopping since the
once the _usedChannels are closed, empty the list in case of the listener being restarted:
|
The channels are removed from the dictionary when the channel disconnect event fires. This event fires when you stop the channel so the following is executed.
In my testing this appears to work well. |
that's true. so that part is OK. Wait for the channels in Stop() before returning. |
OK, it's your framework, but I think it would be better to not block the stop method. Maybe return and fire a stopped event when the tasks finish, maybe even throw a stopping event first. thoughts? |
If the method had been named What you can do is to add the behavior as I suggested to the |
agreed, how about I block the stop method and if you choose you can merge the pull request and create the asynchronous version to your liking? |
sure |
There you go. |
thank you. |
I'm working on HTTP2. Will probably be included in Griffin.Framework sometimes during the summer. |
TcpListener doesn't keep track of used channels and close them on stop. The result is that any established connection continues to be served even after the listener is stopped.
One example is using Griffin.WebServer.HttpServer to serve a web page. If the HttpServer is stopped, the connection remains, until the client browser is stopped.