gameServer/OfficialServer/checker.hs
changeset 8517 648bb1cb7ebc
parent 8515 222f43420615
child 8521 80229928563f
--- a/gameServer/OfficialServer/checker.hs	Mon Feb 18 23:04:38 2013 +0400
+++ b/gameServer/OfficialServer/checker.hs	Tue Feb 19 22:03:33 2013 +0400
@@ -29,6 +29,7 @@
              | CheckSuccess [B.ByteString]
     deriving Show
 
+serverAddress = "netserver.hedgewars.org"
 protocolNumber = "43"
 
 
@@ -43,6 +44,7 @@
     where
         start = flip L.elem ["WINNERS", "DRAW"]
 
+
 checkReplay :: Chan Message -> [B.ByteString] -> IO ()
 checkReplay coreChan msgs = do
     tempDir <- getTemporaryDirectory
@@ -51,7 +53,7 @@
     hFlush h
     hClose h
 
-    (_, Just hErr, _, _) <- createProcess (proc "/usr/home/unC0Rr/Sources/Hedgewars/Releases/0.9.18/bin/hwengine"
+    (_, Just hOut, _, _) <- createProcess (proc "/usr/home/unC0Rr/Sources/Hedgewars/Releases/0.9.18/bin/hwengine"
                 ["/usr/home/unC0Rr/.hedgewars"
                 , "/usr/home/unC0Rr/Sources/Hedgewars/Releases/0.9.18/share/hedgewars/Data"
                 , fileName
@@ -61,8 +63,8 @@
                 , "0"
                 ])
             {std_out = CreatePipe}
-    hSetBuffering hErr LineBuffering
-    void $ forkIO $ engineListener coreChan hErr
+    hSetBuffering hOut LineBuffering
+    void $ forkIO $ engineListener coreChan hOut
 
 
 takePacks :: State B.ByteString [[B.ByteString]]
@@ -125,7 +127,9 @@
         answer ["CHECKER", protocolNumber, l, p]
         answer ["READY"]
     onPacket _ ["PING"] = answer ["PONG"]
-    onPacket chan ("REPLAY":msgs) = checkReplay chan msgs
+    onPacket chan ("REPLAY":msgs) = do
+        checkReplay chan msgs
+        warningM "Check" "Started check"
     onPacket _ ("BYE" : xs) = error $ show xs
     onPacket _ _ = return ()
 
@@ -165,5 +169,3 @@
             sock <- socket AF_INET Stream proto
             connect sock (SockAddrInet 46631 host)
             return sock
-
-        serverAddress = "netserver.hedgewars.org"