From 77165af5e4b4f87a27cf7d85e7f94fab973c0d29 Mon Sep 17 00:00:00 2001 From: "Nico B." Date: Sun, 6 Sep 2026 01:28:19 +0200 Subject: [PATCH] Exclude ServerQuery from online total so it matches the filtered client list. The PR #4 review fix still preferred virtualserver_clientsonline which usually includes Query; subtract bookkeeping Query count before applying the stale-data max. Co-authored-by: Cursor --- connector/src/main.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/connector/src/main.rs b/connector/src/main.rs index dda845b..36026ca 100644 --- a/connector/src/main.rs +++ b/connector/src/main.rs @@ -612,11 +612,18 @@ fn snapshot(con: &data::Connection) -> Event { // Prefer server-reported counters (GTS/TS `virtualserver_*` via notifyserverupdated) // but never under-report vs. the visible (non-Query) client set (stale // optional_data after joins would otherwise freeze the InfoPanel left number). + // `virtualserver_clientsonline` usually includes ServerQuery; subtract the + // Query clients we filtered from the list so the headline matches the tree. let opt = con.server.optional_data.as_ref(); let visible_channels = channels.len() as u64; let visible_clients_count = clients.len() as u16; - let server_clients_online = - opt.map(|d| d.client_count.max(visible_clients_count)).unwrap_or(visible_clients_count); + let query_count = (con.clients.len() as u16).saturating_sub(visible_clients_count); + let server_clients_online = opt + .map(|d| { + let without_query = d.client_count.saturating_sub(query_count); + without_query.max(visible_clients_count) + }) + .unwrap_or(visible_clients_count); let server_channels_online = opt.map(|d| d.channel_count.max(visible_channels)).unwrap_or(visible_channels);