gameServer/ClientIO.hs
branch0.9.16
changeset 5995 647d52370ce9
parent 5989 23407ecb1826
child 7252 74a92f39703b
--- a/gameServer/ClientIO.hs	Mon Sep 19 19:12:19 2011 +0200
+++ b/gameServer/ClientIO.hs	Sun Sep 25 10:48:18 2011 -0400
@@ -58,6 +58,10 @@
 clientSendLoop :: Socket -> ThreadId -> Chan [B.ByteString] -> ClientIndex -> IO ()
 clientSendLoop s tId chan ci = do
     answer <- readChan chan
+
+    when (isQuit answer) $
+        killReciever . B.unpack $ quitMessage answer
+
     Exception.handle
         (\(e :: Exception.IOException) -> unless (isQuit answer) . killReciever $ show e) $
             sendAll s $ B.unlines answer `B.snoc` '\n'
@@ -65,7 +69,6 @@
     if isQuit answer then
         do
         Exception.handle (\(_ :: Exception.IOException) -> putStrLn "error on sClose") $ sClose s
-        killReciever . B.unpack $ quitMessage answer
         else
         clientSendLoop s tId chan ci