aboutsummaryrefslogtreecommitdiff
path: root/internal/game/game.go
diff options
context:
space:
mode:
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))
}