Fix race condition issue in move handling by first recording new game state before sending it to players
This commit is contained in:
parent
bcaa606021
commit
539b74990e
1 changed files with 1 additions and 1 deletions
|
@ -67,12 +67,12 @@ receive (Session.Playing gameKey) played@(Message.Play {}) = do
|
|||
case result of
|
||||
Left message -> sendError message
|
||||
Right newGame -> do
|
||||
Messaging.notifyPlayers newGame logs
|
||||
case KoiKoi.step newGame of
|
||||
KoiKoi.Over -> do
|
||||
App.debug $ "Game " ++ show gameKey ++ " ended"
|
||||
App.update_ $ Server.endGame gameKey
|
||||
_ -> App.update_ $ Server.update gameKey (const newGame)
|
||||
Messaging.notifyPlayers newGame logs
|
||||
|
||||
receive (Session.Playing gameKey) Message.Quit = do
|
||||
games <- (Data.get <$> App.server :: App.T (Map Game.Key Game.T))
|
||||
|
|
Loading…
Reference in a new issue