equal
deleted
inserted
replaced
144 |
144 |
145 clientsChans <- liftM (Prelude.map sendChan . Prelude.filter logonPassed) $! allClientsS |
145 clientsChans <- liftM (Prelude.map sendChan . Prelude.filter logonPassed) $! allClientsS |
146 io $ |
146 io $ |
147 infoM "Clients" (show ci ++ " quits: " ++ B.unpack msg) |
147 infoM "Clients" (show ci ++ " quits: " ++ B.unpack msg) |
148 |
148 |
149 processAction $ AnswerClients [chan] ["BYE", msg] |
|
150 when loggedIn $ processAction $ AnswerClients clientsChans ["LOBBY:LEFT", clNick, msg] |
149 when loggedIn $ processAction $ AnswerClients clientsChans ["LOBBY:LEFT", clNick, msg] |
|
150 |
|
151 mapM processAction |
|
152 [ |
|
153 AnswerClients [chan] ["BYE", msg] |
|
154 , ModifyClient (\c -> c{logonPassed = False}) -- this will effectively hide client from others while he isn't deleted from list |
|
155 ] |
151 |
156 |
152 s <- get |
157 s <- get |
153 put $! s{removedClients = ci `Set.insert` removedClients s} |
158 put $! s{removedClients = ci `Set.insert` removedClients s} |
154 |
159 |
155 processAction (DeleteClient ci) = do |
160 processAction (DeleteClient ci) = do |
520 io $ mapM_ (modifyClient rnc (\cl -> cl{pingsQueue = pingsQueue cl + 1})) cis |
525 io $ mapM_ (modifyClient rnc (\cl -> cl{pingsQueue = pingsQueue cl + 1})) cis |
521 processAction $ AnswerClients chans ["PING"] |
526 processAction $ AnswerClients chans ["PING"] |
522 where |
527 where |
523 kickTimeouted rnc ci = do |
528 kickTimeouted rnc ci = do |
524 pq <- io $ client'sM rnc pingsQueue ci |
529 pq <- io $ client'sM rnc pingsQueue ci |
525 when (pq > 0) $ |
530 when (pq > 0) $ do |
526 withStateT (\as -> as{clientIndex = Just ci}) $ |
531 withStateT (\as -> as{clientIndex = Just ci}) $ |
527 processAction (ByeClient "Ping timeout") |
532 processAction (ByeClient "Ping timeout") |
|
533 when (pq > 1) $ |
|
534 processAction $ DeleteClient ci -- smth went wrong with client io threads, issue DeleteClient here |
528 |
535 |
529 |
536 |
530 processAction StatsAction = do |
537 processAction StatsAction = do |
531 si <- gets serverInfo |
538 si <- gets serverInfo |
532 when (not $ shutdownPending si) $ do |
539 when (not $ shutdownPending si) $ do |