fix root channel bug

This commit is contained in:
2024-11-08 21:27:02 -07:00
parent 326b9eee63
commit af06f65713
+5 -2
View File
@@ -310,8 +310,11 @@ fn accept_packet(
let server = &mut *server;
let id = u.get_session();
let state = server.users.entry(id).or_default();
if u.has_channel_id() {
let state_entry = server.users.entry(id);
let new = matches!(state_entry, std::collections::hash_map::Entry::Vacant(_));
let state = state_entry.or_default();
// the server might now send a channel_id if the user is in channel=0
if u.has_channel_id() || new {
if let Some(parent) = server.channels.get_mut(&state.channel) {
parent.users.remove(&id);
}