gameServer/ClientIO.hs
changeset 5037 1edc06d2247c
parent 5032 813554ab76b8
child 5059 68a5415ca8ea
equal deleted inserted replaced
5036:cb5fa93c7ae0 5037:1edc06d2247c
    42 
    42 
    43         sendPacket packet = writeChan chan $ ClientMessage (ci, packet)
    43         sendPacket packet = writeChan chan $ ClientMessage (ci, packet)
    44 
    44 
    45 clientRecvLoop :: Socket -> Chan CoreMessage -> ClientIndex -> IO ()
    45 clientRecvLoop :: Socket -> Chan CoreMessage -> ClientIndex -> IO ()
    46 clientRecvLoop s chan ci =
    46 clientRecvLoop s chan ci =
    47         (listenLoop s chan ci >> return "Connection closed") `catch` (return . B.pack . show) >>= clientOff >> remove
    47         (listenLoop s chan ci >> return "Connection closed")
       
    48         `Exception.catch` (\(e :: ShutdownThreadException) -> return . B.pack . show $ e)
       
    49         `Exception.catch` (\(e :: Exception.IOException) -> return . B.pack . show $ e)
       
    50         >>= clientOff >> remove
    48     where
    51     where
    49         clientOff msg = writeChan chan $ ClientMessage (ci, ["QUIT", msg])
    52         clientOff msg = writeChan chan $ ClientMessage (ci, ["QUIT", msg])
    50         remove = writeChan chan $ Remove ci
    53         remove = writeChan chan $ Remove ci
    51 
    54 
    52 
    55