gameServer/Actions.hs
changeset 1928 9bf8f4f30d6b
parent 1927 e2031906a347
child 1929 7e6cc8da1c58
--- a/gameServer/Actions.hs	Fri Mar 27 20:29:38 2009 +0000
+++ b/gameServer/Actions.hs	Fri Mar 27 20:36:50 2009 +0000
@@ -343,8 +343,14 @@
 
 
 processAction (clID, serverInfo, clients, rooms) PingAll = do
+	(_, _, newClients, newRooms) <- foldM kickTimeouted (clID, serverInfo, clients, rooms) $ elems clients
 	processAction (clID,
 		serverInfo,
-		map (\cl -> cl{pingsQueue = pingsQueue cl + 1}) clients,
-		rooms) $ AnswerAll ["PING"]
-
+		Data.IntMap.map (\cl -> cl{pingsQueue = pingsQueue cl + 1}) newClients,
+		newRooms) $ AnswerAll ["PING"]
+	where
+		kickTimeouted (clID, serverInfo, clients, rooms) client =
+			if pingsQueue client > 0 then
+				processAction (clientUID client, serverInfo, clients, rooms) $ ByeClient "Ping timeout"
+				else
+				return (clID, serverInfo, clients, rooms)