diff options
| author | historia <[not public]> | 2026-09-18 17:48:26 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-18 17:48:26 -0400 |
| commit | 8fe9e3c3fef0049df82281a62afe35dda516dfe2 (patch) | |
| tree | dd269f2c0710f334e19f00a191260ebc46284a90 /internal/casino/manager.go | |
| parent | 194164a77eb4f2479b94c19e6f0e1278ab608781 (diff) | |
| download | thehouseoficarus-8fe9e3c3fef0049df82281a62afe35dda516dfe2.tar.gz | |
fix: close combat ghost, admin traversal, login throttle, journal double-pay, and quality/economy gaps
Diffstat (limited to 'internal/casino/manager.go')
| -rw-r--r-- | internal/casino/manager.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/internal/casino/manager.go b/internal/casino/manager.go index 8b87147..b1281b2 100644 --- a/internal/casino/manager.go +++ b/internal/casino/manager.go @@ -409,20 +409,28 @@ func (m *Manager) RekeyRooms(idMap map[int]int) { // refunded through each game's refundAll before the entries drop. func (m *Manager) EvictRoom(roomID int) []Event { prefix := fmt.Sprintf("%d:", roomID) - var events []Event + // Snapshot the games under the manager lock, then refund OUTSIDE it: + // refundAll appends to the money journal and saves character files, and + // holding m.mu across that I/O blocks every casino command and Tick. + type evictable interface{ refundAll() []Event } + var evicted []evictable m.mu.Lock() for key, table := range m.tables { if strings.HasPrefix(key, prefix) { - events = append(events, table.refundAll()...) + evicted = append(evicted, table) delete(m.tables, key) } } for key, machine := range m.machines { if strings.HasPrefix(key, prefix) { - events = append(events, machine.refundAll()...) + evicted = append(evicted, machine) delete(m.machines, key) } } m.mu.Unlock() + var events []Event + for _, game := range evicted { + events = append(events, game.refundAll()...) + } return events } |
