-
Notifications
You must be signed in to change notification settings - Fork 230
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
Move cl.WriteLoop() to attachClient() and call cl.Stop() in loadClients() to update client.State. #344
Conversation
…n such as disconnected time, and set the stopCause.
Pull Request Test Coverage Report for Build 7294678352
💛 - Coveralls |
@thedevop @x20080406 @mochi-co @dgduncan I have added a call to cl.Stop() in loadClients() to cancel the client's context, update cl.State with information such as disconnected time, and set the stopCause. Please let me know if there are any other cases that need to be considered. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a much better idea!
In the server.loadClients() and when using inlineClient, NewClient() is called, but these may not necessarily represent actual connections. Calling go cl.WriteLoop() within NewClient() leads to a goroutine leak. I think moving go cl.WriteLoop() out of NewClient() and placing it in either server.EstablishConnection() or server.attachClient() would be more reasonable.