Better quit message
authorunc0rr
Sat, 12 Mar 2011 22:55:25 +0300
changeset 5001 312f4dd41753
parent 5000 72d8fb26223d
child 5002 a9c44a8ffec8
child 5003 db4726bf9205
Better quit message
gameServer/ClientIO.hs
gameServer/CoreTypes.hs
--- a/gameServer/ClientIO.hs	Sat Mar 12 22:42:01 2011 +0300
+++ b/gameServer/ClientIO.hs	Sat Mar 12 22:55:25 2011 +0300
@@ -66,11 +66,14 @@
     if isQuit answer then
         do
         Exception.handle (\(_ :: Exception.IOException) -> putStrLn "error on sClose") $ sClose s
-        killReciever "Connection closed"
+        killReciever . B.unpack $ quitMessage answer
         else
         clientSendLoop s tId cChan chan ci
 
     where
         killReciever = Exception.throwTo tId . ShutdownThreadException
+        quitMessage ["BYE"] = "bye"
+        quitMessage ("BYE":msg:_) = msg
+        quitMessage _ = error "quitMessage"
         isQuit ("BYE":_) = True
         isQuit _ = False
--- a/gameServer/CoreTypes.hs	Sat Mar 12 22:42:01 2011 +0300
+++ b/gameServer/CoreTypes.hs	Sat Mar 12 22:55:25 2011 +0300
@@ -210,5 +210,5 @@
      deriving Typeable
 
 instance Show ShutdownThreadException where
-    show (ShutdownThreadException s) = "kill: " ++ s
+    show (ShutdownThreadException s) = s
 instance Exception ShutdownThreadException