gameServer/Actions.hs
changeset 5003 db4726bf9205
parent 4999 a3a09b107652
child 5005 d7bddb280f4f
equal deleted inserted replaced
5001:312f4dd41753 5003:db4726bf9205
   403     let newLogins = takeWhile (\(_ , (time, _)) -> connectTime cl `diffUTCTime` time <= 0) $ lastLogins si
   403     let newLogins = takeWhile (\(_ , (time, _)) -> connectTime cl `diffUTCTime` time <= 0) $ lastLogins si
   404     let info = host cl `Prelude.lookup` newLogins
   404     let info = host cl `Prelude.lookup` newLogins
   405     if isJust info then
   405     if isJust info then
   406         mapM_ processAction [ModifyServerInfo (\s -> s{lastLogins = newLogins}), ByeClient (snd .  fromJust $ info)]
   406         mapM_ processAction [ModifyServerInfo (\s -> s{lastLogins = newLogins}), ByeClient (snd .  fromJust $ info)]
   407         else
   407         else
   408         processAction $ ModifyServerInfo (\s -> s{lastLogins = (host cl, (addUTCTime 10 $ connectTime cl, "Reconnected too fast")) : newLogins})
   408         processAction $ ModifyServerInfo (\s -> s{lastLogins = (host cl, (addUTCTime 0 $ connectTime cl, "Reconnected too fast")) : newLogins})
   409 
   409 
   410 
   410 
   411 processAction PingAll = do
   411 processAction PingAll = do
   412     rnc <- gets roomsClients
   412     rnc <- gets roomsClients
   413     io (allClientsM rnc) >>= mapM_ (kickTimeouted rnc)
   413     io (allClientsM rnc) >>= mapM_ (kickTimeouted rnc)