--- a/gameServer/Actions.hs Fri Feb 15 00:12:19 2013 +0400
+++ b/gameServer/Actions.hs Sat Feb 16 23:28:16 2013 +0400
@@ -78,6 +78,8 @@
| SaveReplay
| Stats
| CheckRecord
+ | CheckFailed B.ByteString
+ | CheckSuccess [B.ByteString]
type CmdHandler = [B.ByteString] -> Reader (ClientIndex, IRnC) [Action]
@@ -681,7 +683,20 @@
processAction $ AnswerClients [c] ("REPLAY" : l)
+processAction CheckRecord = do
+ p <- client's clientProto
+ c <- client's sendChan
+ l <- io $ loadReplay (fromIntegral p)
+ when (not $ null l) $
+ processAction $ AnswerClients [c] ("REPLAY" : l)
+
+processAction (CheckFailed msg) = return ()
+
+processAction (CheckSuccess info) = return ()
+
#else
processAction SaveReplay = return ()
processAction CheckRecord = return ()
+processAction (CheckFailed _) = return ()
+processAction (CheckSuccess _) = return ()
#endif
--- a/gameServer/CoreTypes.hs Fri Feb 15 00:12:19 2013 +0400
+++ b/gameServer/CoreTypes.hs Sat Feb 16 23:28:16 2013 +0400
@@ -17,6 +17,13 @@
type ClientChan = Chan [B.ByteString]
+data CheckInfo =
+ CheckInfo
+ {
+ recordFileName :: B.ByteString,
+ recordTeams :: [TeamInfo]
+ }
+
data ClientInfo =
ClientInfo
{
@@ -39,6 +46,7 @@
isChecker :: Bool,
isKickedFromServer :: Bool,
clientClan :: !(Maybe B.ByteString),
+ checkInfo :: Maybe CheckInfo,
teamsInGame :: Word
}
--- a/gameServer/HWProtoChecker.hs Fri Feb 15 00:12:19 2013 +0400
+++ b/gameServer/HWProtoChecker.hs Sat Feb 16 23:28:16 2013 +0400
@@ -18,4 +18,19 @@
handleCmd_checker ["READY"] = return [CheckRecord]
+handleCmd_checker ["CHECKED", "FAIL", msg] = do
+ isChecking <- liftM (isJust . checkInfo) thisClient
+ if not isChecking then
+ return []
+ else
+ return [CheckFailed msg, ModifyClient $ \c -> c{checkInfo = Nothing}]
+
+
+handleCmd_checker ("CHECKED" : "OK" : info) = do
+ isChecking <- liftM (isJust . checkInfo) thisClient
+ if not isChecking then
+ return []
+ else
+ return [CheckSuccess info, ModifyClient $ \c -> c{checkInfo = Nothing}]
+
handleCmd_checker _ = return [ProtocolError "Unknown command"]
--- a/gameServer/NetRoutines.hs Fri Feb 15 00:12:19 2013 +0400
+++ b/gameServer/NetRoutines.hs Sat Feb 16 23:28:16 2013 +0400
@@ -45,6 +45,7 @@
False
False
Nothing
+ Nothing
0
)
--- a/gameServer/OfficialServer/checker.hs Fri Feb 15 00:12:19 2013 +0400
+++ b/gameServer/OfficialServer/checker.hs Sat Feb 16 23:28:16 2013 +0400
@@ -109,7 +109,8 @@
main :: IO ()
main = withSocketsDo $ do
#if !defined(mingw32_HOST_OS)
- installHandler sigPIPE Ignore Nothing;
+ installHandler sigPIPE Ignore Nothing
+ installHandler sigCHLD Ignore Nothing
#endif
updateGlobalLogger "Core" (setLevel DEBUG)