diff -r cd4433b44920 -r 31e042ab870c gameServer/Actions.hs --- a/gameServer/Actions.hs Wed Jan 26 22:26:02 2011 +0300 +++ b/gameServer/Actions.hs Thu Jan 27 22:06:42 2011 +0300 @@ -13,6 +13,7 @@ import Control.Monad.Reader import Control.Monad.State.Strict import qualified Data.ByteString.Char8 as B +import Control.DeepSeq ----------------------------- import CoreTypes import Utils @@ -52,6 +53,12 @@ type CmdHandler = [B.ByteString] -> Reader (ClientIndex, IRnC) [Action] +instance NFData Action where + rnf (AnswerClients chans msg) = chans `deepseq` msg `deepseq` () + rnf a = a `seq` () + +instance NFData B.ByteString +instance NFData (Chan a) othersChans = do cl <- client's id @@ -62,7 +69,7 @@ processAction (AnswerClients chans msg) = do - liftIO $ map (flip seq ()) chans `seq` map (flip seq ()) msg `seq` mapM_ (flip writeChan msg) chans + liftIO $ mapM_ (flip writeChan msg) chans processAction SendServerMessage = do @@ -177,11 +184,11 @@ processAction (MoveToRoom ri) = do (Just ci) <- gets clientIndex rnc <- gets roomsClients + liftIO $ do modifyClient rnc (\cl -> cl{teamsInGame = 0, isReady = False, isMaster = False}) ci modifyRoom rnc (\r -> r{playersIn = (playersIn r) + 1}) ri - - liftIO $ moveClientToRoom rnc ri ci + moveClientToRoom rnc ri ci chans <- liftM (map sendChan) $ roomClientsS ri clNick <- client's nick