mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-03 01:42:50 +08:00
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 <cursoragent@cursor.com>
This commit is contained in:
1 parent
a118c0f58e
commit
77165af5e4
1 file changed
+9
-2
@@ -612,11 +612,18 @@ fn snapshot(con: &data::Connection) -> Event {
|
|||||||
// Prefer server-reported counters (GTS/TS `virtualserver_*` via notifyserverupdated)
|
// Prefer server-reported counters (GTS/TS `virtualserver_*` via notifyserverupdated)
|
||||||
// but never under-report vs. the visible (non-Query) client set (stale
|
// but never under-report vs. the visible (non-Query) client set (stale
|
||||||
// optional_data after joins would otherwise freeze the InfoPanel left number).
|
// 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 opt = con.server.optional_data.as_ref();
|
||||||
let visible_channels = channels.len() as u64;
|
let visible_channels = channels.len() as u64;
|
||||||
let visible_clients_count = clients.len() as u16;
|
let visible_clients_count = clients.len() as u16;
|
||||||
let server_clients_online =
|
let query_count = (con.clients.len() as u16).saturating_sub(visible_clients_count);
|
||||||
opt.map(|d| d.client_count.max(visible_clients_count)).unwrap_or(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 =
|
let server_channels_online =
|
||||||
opt.map(|d| d.channel_count.max(visible_channels)).unwrap_or(visible_channels);
|
opt.map(|d| d.channel_count.max(visible_channels)).unwrap_or(visible_channels);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user