Merged
Conversation
adds connection introspection commands for debugging active connections — who's connected, from where, and what they named themselves. - CLIENT ID returns the unique monotonic connection ID - CLIENT SETNAME / GETNAME sets and retrieves a human-readable name - CLIENT LIST dumps all connected clients with id, addr, name, age the client registry is a lightweight Arc<Mutex<HashMap>> on ServerContext, only touched on accept/disconnect/CLIENT commands. zero impact on the GET/SET hot path — the mutex is never contended during normal command processing.
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.
summary
adds connection introspection commands for debugging active connections — who's connected, from where, what they named themselves.
CLIENT ID— returns the unique monotonic connection ID (assigned at accept)CLIENT SETNAME name/CLIENT GETNAME— set/get a human-readable connection nameCLIENT LIST— dumps all connected clients withid,addr,name,agethe client registry is a lightweight
Arc<Mutex<HashMap<u64, ClientInfo>>>onServerContext, only touched on accept, disconnect, and CLIENT commands. the mutex is never contended on the GET/SET hot path.what's not included (follow-up)
what was tested
parse_client_id,parse_client_id_case_insensitive,parse_client_getname,parse_client_setname,parse_client_setname_missing_name,parse_client_list,parse_client_unknown_subcommand,parse_client_no_subcommandcargo clippy --workspace -- -D warningscleancargo fmt --allcleandesign considerations
AtomicU64::fetch_add(1, Relaxed)— monotonically increasing, unique per server lifetime.format_client_listhelper lives inserver.rsaspub(crate)so both sharded and concurrent handlers can share it without duplication.ClientInfostoresaddr,name, andconnected_at— enough for debugging without touching the hot path.