gameServer/Actions.hs
changeset 7465 c2dcf97ca664
parent 7351 34efdd1f230f
child 7498 86984f6fa1b9
--- a/gameServer/Actions.hs	Fri Jul 27 23:16:30 2012 -0400
+++ b/gameServer/Actions.hs	Tue Jul 31 23:29:00 2012 +0400
@@ -146,9 +146,14 @@
     io $
         infoM "Clients" (show ci ++ " quits: " ++ B.unpack msg)
 
-    processAction $ AnswerClients [chan] ["BYE", msg]
     when loggedIn $ processAction $ AnswerClients clientsChans ["LOBBY:LEFT", clNick, msg]
 
+    mapM processAction
+        [
+        AnswerClients [chan] ["BYE", msg]
+        , ModifyClient (\c -> c{logonPassed = False}) -- this will effectively hide client from others while he isn't deleted from list
+        ]
+
     s <- get
     put $! s{removedClients = ci `Set.insert` removedClients s}
 
@@ -522,9 +527,11 @@
     where
         kickTimeouted rnc ci = do
             pq <- io $ client'sM rnc pingsQueue ci
-            when (pq > 0) $
+            when (pq > 0) $ do
                 withStateT (\as -> as{clientIndex = Just ci}) $
                     processAction (ByeClient "Ping timeout")
+                when (pq > 1) $
+                    processAction $ DeleteClient ci -- smth went wrong with client io threads, issue DeleteClient here
 
 
 processAction StatsAction = do