aboutsummaryrefslogtreecommitdiff
path: root/internal/game/game.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-18 01:50:17 -0400
committerhistoria <[not public]>2026-09-18 01:50:17 -0400
commit87d08f0151e643951769e323995f1c5ed89ee200 (patch)
treedc42a0b30ebb5a00dd7ba505cc4eaa44f4f308bc /internal/game/game.go
parent32a3c59cebf2a16277e54d715a67adfdbe00b456 (diff)
downloadthehouseoficarus-87d08f0151e643951769e323995f1c5ed89ee200.tar.gz
fix: harden economy recovery, shutdown concurrency, world validation, and inventory-loss paths
Diffstat (limited to 'internal/game/game.go')
-rw-r--r--internal/game/game.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/internal/game/game.go b/internal/game/game.go
index fc6914f..ef48b63 100644
--- a/internal/game/game.go
+++ b/internal/game/game.go
@@ -187,6 +187,13 @@ func (g *Game) SetHub(hub *net.Hub) {
})
hub.OnDisconnect(func(sess *net.Session) {
g.run(func() {
+ // During graceful shutdown the shutdown sequence owns final
+ // persistence and refunds outstanding wagers; a disconnect
+ // forfeit here would destroy a stake the shutdown policy
+ // promises to return. Mirrors the OnRemove guard.
+ if g.isShuttingDown() {
+ return
+ }
if sess.Player != nil {
g.emitCasinoEvents(g.Casino.MarkDisconnected(sess.Player.Name))
}