gameServer/HWProtoChecker.hs
changeset 9433 f0a8ac191839
parent 9109 878f06e9c484
child 9444 30748b1d9ec7
equal deleted inserted replaced
9431:0f5961910e27 9433:f0a8ac191839
     9 import HandlerUtils
     9 import HandlerUtils
    10 
    10 
    11 
    11 
    12 handleCmd_checker :: CmdHandler
    12 handleCmd_checker :: CmdHandler
    13 
    13 
    14 handleCmd_checker ["READY"] = return [CheckRecord]
    14 handleCmd_checker ["READY"] = return [ModifyClient $ \c -> c{isReady = True}, CheckRecord]
    15 
    15 
    16 handleCmd_checker ["CHECKED", "FAIL", msg] = do
    16 handleCmd_checker ["CHECKED", "FAIL", msg] = do
    17     isChecking <- liftM (isJust . checkInfo) thisClient
    17     isChecking <- liftM (isJust . checkInfo) thisClient
    18     if not isChecking then
    18     if not isChecking then
    19         return []
    19         return []
    20         else
    20         else
    21         return [CheckFailed msg, ModifyClient $ \c -> c{checkInfo = Nothing}]
    21         return [CheckFailed msg, ModifyClient $ \c -> c{isReady = False, checkInfo = Nothing}]
    22 
    22 
    23 
    23 
    24 handleCmd_checker ("CHECKED" : "OK" : info) = do
    24 handleCmd_checker ("CHECKED" : "OK" : info) = do
    25     isChecking <- liftM (isJust . checkInfo) thisClient
    25     isChecking <- liftM (isJust . checkInfo) thisClient
    26     if not isChecking then
    26     if not isChecking then
    27         return []
    27         return []
    28         else
    28         else
    29         return [CheckSuccess info, ModifyClient $ \c -> c{checkInfo = Nothing}]
    29         return [CheckSuccess info, ModifyClient $ \c -> c{isReady = False, checkInfo = Nothing}]
    30 
    30 
    31 handleCmd_checker _ = return [ProtocolError "Unknown command"]
    31 handleCmd_checker _ = return [ProtocolError "Unknown command"]