aboutsummaryrefslogtreecommitdiff
path: root/internal/net/server.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-10-06 12:57:23 -0400
committerhistoria <[not public]>2026-10-06 12:57:23 -0400
commit9666676766bf21364f4fc4d0d1d336e72f2a91b4 (patch)
tree0cade34091d7602790dc38cd44053f0b74bbadf2 /internal/net/server.go
parent4bc1daaf259e0c19c5fe4a12ec8bc7f6e5a735c1 (diff)
downloadthehouseoficarus-9666676766bf21364f4fc4d0d1d336e72f2a91b4.tar.gz
refactor: split casino.go, dedup helpers, remove audit docs
Diffstat (limited to 'internal/net/server.go')
-rw-r--r--internal/net/server.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/internal/net/server.go b/internal/net/server.go
index 0854426..d1a0492 100644
--- a/internal/net/server.go
+++ b/internal/net/server.go
@@ -570,7 +570,14 @@ func (h *Hub) RekeyRooms(idMap map[int]int) {
moved := make(map[int]map[*Session]bool, len(h.rooms))
for id, set := range h.rooms {
if newID, ok := idMap[id]; ok && newID != id {
- moved[newID] = set
+ if moved[newID] == nil {
+ moved[newID] = make(map[*Session]bool)
+ }
+ // Merge rather than assign: a many-to-one idMap (A->C, B->C)
+ // would otherwise clobber the first source bucket's sessions.
+ for s := range set {
+ moved[newID][s] = true
+ }
delete(h.rooms, id)
}
}