engine: track the server tree so a hub SQUIT cascades
All checks were successful
CI / check (push) Successful in 3m50s

SQUIT arrives once for a splitting server (by SID), but a hub takes its
whole subtree with it — users behind downstream servers were left as stale
state. The parser now distinguishes a sourced downstream SERVER (tracked
with its parent) from the unsourced uplink handshake, the engine keeps the
SID->parent tree, and a SQUIT forgets every user across the departed
server's subtree. Tree is rebuilt each link. Wire formats verified against
the InspIRCd 4 m_spanningtree source.
This commit is contained in:
Jean Chevronnet 2026-07-16 10:31:29 +00:00
parent e5e04b4130
commit 320a591ae3
No known key found for this signature in database
5 changed files with 97 additions and 7 deletions

View file

@ -783,6 +783,7 @@ impl Engine {
self.bot_idents.clear();
self.bot_channels.clear();
self.network.clear_bots();
self.network.clear_servers(); // the burst re-introduces the server tree
self.next_bot_index = 0;
let mut out = vec![NetAction::Burst];
for svc in &self.services {
@ -1068,11 +1069,17 @@ impl Engine {
self.forget_user(&uid);
Vec::new()
}
NetEvent::ServerLink { sid, parent } => {
self.network.server_link(&sid, &parent);
Vec::new()
}
NetEvent::ServerSplit { server } => {
// Every user behind the departed server is gone in one message;
// forget them so their sessions, slots and memberships don't linger.
for uid in self.network.uids_on_server(&server) {
self.forget_user(&uid);
// A hub's SQUIT arrives once but takes its whole subtree with it;
// forget every user behind the departed server and its descendants.
for sid in self.network.server_split(&server) {
for uid in self.network.uids_on_server(&sid) {
self.forget_user(&uid);
}
}
Vec::new()
}