340 infoM "Clients" ((show $ clientUID client) ++ ": New client. Time: " ++ (show $ connectTime client)) |
340 infoM "Clients" ((show $ clientUID client) ++ ": New client. Time: " ++ (show $ connectTime client)) |
341 writeChan (sendChan $ client) ["CONNECTED", "Hedgewars server http://www.hedgewars.org/"] |
341 writeChan (sendChan $ client) ["CONNECTED", "Hedgewars server http://www.hedgewars.org/"] |
342 |
342 |
343 let newLogins = takeWhile (\(_ , time) -> (connectTime client) `diffUTCTime` time <= 20) $ lastLogins serverInfo |
343 let newLogins = takeWhile (\(_ , time) -> (connectTime client) `diffUTCTime` time <= 20) $ lastLogins serverInfo |
344 |
344 |
345 -- if isJust $ host client `Prelude.lookup` newLogins then |
345 if isJust $ host client `Prelude.lookup` newLogins then |
346 -- processAction (clID, serverInfo{lastLogins = newLogins}, updatedClients, rooms) $ ByeClient "Reconnected too fast" |
346 processAction (clID, serverInfo{lastLogins = newLogins}, updatedClients, rooms) $ ByeClient "Reconnected too fast" |
347 -- else |
347 else |
348 return (clID, serverInfo{lastLogins = (host client, connectTime client) : newLogins}, updatedClients, rooms) |
348 return (clID, serverInfo{lastLogins = (host client, connectTime client) : newLogins}, updatedClients, rooms) |
349 |
349 |
350 |
350 |
351 processAction (clID, serverInfo, clients, rooms) PingAll = do |
351 processAction (clID, serverInfo, clients, rooms) PingAll = do |
352 (_, _, newClients, newRooms) <- foldM kickTimeouted (clID, serverInfo, clients, rooms) $ elems clients |
352 (_, _, newClients, newRooms) <- foldM kickTimeouted (clID, serverInfo, clients, rooms) $ elems clients |
353 processAction (clID, |
353 processAction (clID, |