--- a/gameServer/Actions.hs Wed Feb 23 18:38:11 2011 +0300
+++ b/gameServer/Actions.hs Thu Feb 24 22:01:36 2011 +0300
@@ -14,6 +14,7 @@
import Control.DeepSeq
import Data.Unique
import Control.Arrow
+import Control.Exception
-----------------------------
import CoreTypes
import Utils
@@ -415,6 +416,6 @@
processAction (RestartServer force) = do
if force then do
- return ()
+ io $ throwIO ShutdownException
else
processAction $ ModifyServerInfo (\s -> s{restartPending=True})
--- a/gameServer/CoreTypes.hs Wed Feb 23 18:38:11 2011 +0300
+++ b/gameServer/CoreTypes.hs Thu Feb 24 22:01:36 2011 +0300
@@ -1,8 +1,7 @@
-{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE OverloadedStrings, DeriveDataTypeable #-}
module CoreTypes where
import Control.Concurrent
-import Control.Concurrent.STM
import Data.Word
import qualified Data.Map as Map
import Data.Sequence(Seq, empty)
@@ -11,7 +10,9 @@
import Data.Function
import Data.ByteString.Char8 as B
import Data.Unique
-
+import Control.Exception
+import Data.Typeable
+-----------------------
import RoomsAndClients
type ClientChan = Chan [B.ByteString]
@@ -190,4 +191,9 @@
data Notice =
NickAlreadyInUse
| AdminLeft
- deriving Enum
\ No newline at end of file
+ deriving Enum
+
+data ShutdownException = ShutdownException
+ deriving (Show, Typeable)
+
+instance Exception ShutdownException