gameServer/Actions.hs
changeset 4955 84543ecae8c3
parent 4942 1c85a8e6e11c
child 4959 09f4978b4fb0
equal deleted inserted replaced
4952:df752b69a142 4955:84543ecae8c3
    51     | DeleteClient ClientIndex
    51     | DeleteClient ClientIndex
    52     | PingAll
    52     | PingAll
    53     | StatsAction
    53     | StatsAction
    54     | RestartServer Bool
    54     | RestartServer Bool
    55 
    55 
       
    56 
    56 type CmdHandler = [B.ByteString] -> Reader (ClientIndex, IRnC) [Action]
    57 type CmdHandler = [B.ByteString] -> Reader (ClientIndex, IRnC) [Action]
    57 
    58 
    58 instance NFData Action where
    59 instance NFData Action where
    59     rnf (AnswerClients chans msg) = chans `deepseq` msg `deepseq` ()
    60     rnf (AnswerClients chans msg) = chans `deepseq` msg `deepseq` ()
    60     rnf a = a `seq` ()
    61     rnf a = a `seq` ()
   410     (roomsNum, clientsNum) <- io $ withRoomsAndClients rnc st
   411     (roomsNum, clientsNum) <- io $ withRoomsAndClients rnc st
   411     io $ writeChan (dbQueries si) $ SendStats clientsNum (roomsNum - 1)
   412     io $ writeChan (dbQueries si) $ SendStats clientsNum (roomsNum - 1)
   412     where
   413     where
   413           st irnc = (length $ allRooms irnc, length $ allClients irnc)
   414           st irnc = (length $ allRooms irnc, length $ allClients irnc)
   414 
   415 
   415 processAction (RestartServer _) =
   416 processAction (RestartServer force) = do
   416     return ()
   417     if force then do
       
   418         return ()
       
   419         else
       
   420         processAction $ ModifyServerInfo (\s -> s{restartPending=True})