server: clean up old unused connections#43
Merged
kaichaosun merged 1 commit intokaichaosun:mainfrom May 26, 2025
Merged
Conversation
kaichaosun
reviewed
May 26, 2025
| Err(_) => { | ||
| // timeout, cleanup old connections | ||
| let mut manager = manager.lock().await; | ||
| manager.cleanup().await; |
Owner
There was a problem hiding this comment.
For Websocket, the longer time connection is expected, if this changes applied, does it mean the websocket connection will be closed after 60 seconds?
Contributor
Author
There was a problem hiding this comment.
No, the client won't be removed if at least one WebSocket is still actually using the tunnel.
But I can make it to whatever duration you prefer regardless.
Once a client was established, server kept listening on its TCP socket forever. Neither the listener or its task was ever cleaned up, resulting in memory and fd usage growing forever until we eventually run of fds. Fix it by removing clients which have not been used for one hour.
kaichaosun
approved these changes
May 26, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Once a client was established, server kept listening on its TCP socket forever. Neither the listener or its task was ever cleaned up, resulting in memory and fd usage growing forever until we eventually run of fds.
Fix it by removing clients which have not been used for one hour.