engine: forget a split server's users on SQUIT
All checks were successful
CI / check (push) Successful in 3m47s

A netsplit is signalled once via SQUIT, not as a QUIT per user, so every
user behind the departed server lingered in services' state — stale
sessions, session-limit slots, and channel memberships. The parser now
surfaces ServerSplit and the engine forgets every uid carrying that
server's SID prefix, leaving other servers' users untouched.
This commit is contained in:
Jean Chevronnet 2026-07-16 10:10:20 +00:00
parent 63ecd79b12
commit 4aff734340
No known key found for this signature in database
5 changed files with 49 additions and 0 deletions

View file

@ -180,6 +180,12 @@ impl Network {
self.users.get(uid).map(|u| u.host.as_str())
}
// Every known user whose uid carries `sid` as its prefix — i.e. those behind
// a server, used to forget them all when it splits (SQUIT).
pub fn uids_on_server(&self, sid: &str) -> Vec<String> {
self.users.keys().filter(|u| u.starts_with(sid)).cloned().collect()
}
pub fn user_nick_change(&mut self, uid: &str, nick: String) {
if let Some(user) = self.users.get_mut(uid) {
self.seen.insert(lc(&nick), Seen { nick: nick.clone(), ts: now(), what: format!("changing nick from {}", user.nick) });