gameServer/hedgewars-server.hs
changeset 5209 f7a610e2ef5f
parent 5119 f475e10c4081
child 10051 cc6f62d7aea2
--- a/gameServer/hedgewars-server.hs	Thu May 12 23:29:31 2011 +0200
+++ b/gameServer/hedgewars-server.hs	Sun May 15 18:10:01 2011 +0400
@@ -7,7 +7,6 @@
 import Control.Concurrent.Chan
 import qualified Control.Exception as E
 import System.Log.Logger
-import System.Process
 -----------------------------------
 import Opts
 import CoreTypes
@@ -22,9 +21,9 @@
 
 
 setupLoggers :: IO ()
-setupLoggers =
-    updateGlobalLogger "Clients"
-        (setLevel NOTICE)
+setupLoggers = do
+    updateGlobalLogger "Clients" (setLevel NOTICE)
+    updateGlobalLogger "Core" (setLevel NOTICE)
 
 
 server :: ServerInfo -> IO ()
@@ -37,13 +36,12 @@
             setSocketOption sock ReuseAddr 1
             bindSocket sock (SockAddrInet (listenPort si) iNADDR_ANY)
             listen sock maxListenQueue
-            startServer si sock
+            startServer si{serverSocket = Just sock}
         )
 
 handleRestart :: ShutdownException -> IO ()
-handleRestart ShutdownException = return ()
-handleRestart RestartException = do
-    _ <- createProcess (proc "./hedgewars-server" [])
+handleRestart ShutdownException = do
+    noticeM "Core" "Shutting down"
     return ()
 
 main :: IO ()
@@ -57,7 +55,7 @@
 
     dbQueriesChan <- newChan
     coreChan' <- newChan
-    serverInfo' <- getOpts $ newServerInfo coreChan' dbQueriesChan Nothing
+    serverInfo' <- getOpts $ newServerInfo coreChan' dbQueriesChan Nothing Nothing
 
 #if defined(OFFICIAL_SERVER)
     si <- readServerConfig serverInfo'