415 processAction (ci, serverInfo{lastLogins = newLogins}, rnc) $ ByeClient "Reconnected too fast" |
415 processAction (ci, serverInfo{lastLogins = newLogins}, rnc) $ ByeClient "Reconnected too fast" |
416 else |
416 else |
417 return (ci, serverInfo) |
417 return (ci, serverInfo) |
418 -} |
418 -} |
419 |
419 |
420 |
420 |
421 |
421 |
422 |
422 processAction PingAll = do |
423 {- |
423 rnc <- gets roomsClients |
424 processAction (clID, serverInfo, rnc) PingAll = do |
424 cis <- liftIO $ allClientsM rnc |
425 (_, _, newClients, newRooms) <- foldM kickTimeouted (clID, serverInfo, rnc) $ elems clients |
425 mapM_ (kickTimeouted rnc) $ cis |
426 processAction (clID, |
426 chans <- liftIO $ mapM (client'sM rnc sendChan) cis |
427 serverInfo, |
427 liftIO $ mapM_ (modifyClient rnc (\cl -> cl{pingsQueue = pingsQueue cl + 1})) cis |
428 Data.IntMap.map (\cl -> cl{pingsQueue = pingsQueue cl + 1}) newClients, |
428 processAction $ AnswerClients chans ["PING"] |
429 newRooms) $ AnswerAll ["PING"] |
429 where |
430 where |
430 kickTimeouted rnc ci = do |
431 kickTimeouted (clID, serverInfo, rnc) client = |
431 pq <- liftIO $ client'sM rnc pingsQueue ci |
432 if pingsQueue client > 0 then |
432 when (pq > 0) $ |
433 processAction (clientUID client, serverInfo, rnc) $ ByeClient "Ping timeout" |
433 withStateT (\as -> as{clientIndex = Just ci}) $ |
434 else |
434 processAction (ByeClient "Ping timeout") |
435 return (clID, serverInfo, rnc) |
435 |
436 |
|
437 -} |
|
438 |
436 |
439 processAction (StatsAction) = do |
437 processAction (StatsAction) = do |
440 rnc <- gets roomsClients |
438 rnc <- gets roomsClients |
441 si <- gets serverInfo |
439 si <- gets serverInfo |
442 (roomsNum, clientsNum) <- liftIO $ withRoomsAndClients rnc stats |
440 (roomsNum, clientsNum) <- liftIO $ withRoomsAndClients rnc stats |