gameServer/Actions.hs
changeset 5212 eaffb02f0053
parent 5211 8ebf92014447
child 5214 d2ad737891b0
--- a/gameServer/Actions.hs	Mon May 16 22:03:14 2011 +0400
+++ b/gameServer/Actions.hs	Mon May 16 22:04:59 2011 +0400
@@ -468,22 +468,24 @@
 processAction StatsAction = do
     si <- gets serverInfo
     when (not $ shutdownPending si) $ do
-    rnc <- gets roomsClients
-    (roomsNum, clientsNum) <- io $ withRoomsAndClients rnc st
-    io $ writeChan (dbQueries si) $ SendStats clientsNum (roomsNum - 1)
+        rnc <- gets roomsClients
+        (roomsNum, clientsNum) <- io $ withRoomsAndClients rnc st
+        io $ writeChan (dbQueries si) $ SendStats clientsNum (roomsNum - 1)
     where
           st irnc = (length $ allRooms irnc, length $ allClients irnc)
 
-processAction RestartServer = do
-    sock <- gets (fromJust . serverSocket . serverInfo)
-    args <- gets (runArgs . serverInfo)
-    io $ do
-        noticeM "Core" "Closing listening socket"
-        sClose sock
-        noticeM "Core" "Spawning new server"
-        _ <- createProcess (proc "./hedgewars-server" args)
-        return ()
-    processAction $ ModifyServerInfo (\s -> s{shutdownPending=True})
+processAction RestartServer = do 
+    sp <- gets (shutdownPending . serverInfo)
+    when (not sp) $ do
+        sock <- gets (fromJust . serverSocket . serverInfo)
+        args <- gets (runArgs . serverInfo)
+        io $ do
+            noticeM "Core" "Closing listening socket"
+            sClose sock
+            noticeM "Core" "Spawning new server"
+            _ <- createProcess (proc "./hedgewars-server" args)
+            return ()
+        processAction $ ModifyServerInfo (\s -> s{shutdownPending = True})
 
 processAction SaveReplay = do
     ri <- clientRoomA