server: skip the O(users) callerid ACCEPT scrub on quit unless the departing nick is actually accepted by someone — a reverse count (accepted_nicks) maintained through centralized accept_add/accept_remove helpers avoids scanning every user's accept list on each quit (O(users*quits) on a netsplit); the full scrub still runs when the count is nonzero, so the nick-reuse protection is unchanged

This commit is contained in:
Jean Chevronnet 2026-08-19 02:21:38 +00:00
parent ab0ccae71f
commit fb1a9f3d70
3 changed files with 63 additions and 10 deletions

View file

@ -373,8 +373,8 @@ impl Command for Accept {
ERR_ACCEPTFULL,
&format!("{name} :Your accept list is full"),
);
} else if let Some(u) = s.users.get_mut(&uid) {
u.accept.push(low);
} else {
s.accept_add(uid, low);
}
} else {
let existed = s
@ -388,8 +388,8 @@ impl Command for Accept {
ERR_ACCEPTNOT,
&format!("{name} :is not on your accept list"),
);
} else if let Some(u) = s.users.get_mut(&uid) {
u.accept.retain(|x| x != &low);
} else {
s.accept_remove(uid, &low);
}
}
}