equal
deleted
inserted
replaced
44 recieveWithBufferLoop newrecvBuf |
44 recieveWithBufferLoop newrecvBuf |
45 |
45 |
46 sendPacket packet = writeChan chan $ ClientMessage (ci, packet) |
46 sendPacket packet = writeChan chan $ ClientMessage (ci, packet) |
47 |
47 |
48 clientRecvLoop :: Socket -> Chan CoreMessage -> ClientIndex -> IO () |
48 clientRecvLoop :: Socket -> Chan CoreMessage -> ClientIndex -> IO () |
49 clientRecvLoop s chan ci = Exception.block $ |
49 clientRecvLoop s chan ci = |
50 ((Exception.unblock $ listenLoop s chan ci >> return "Connection closed") `catch` (return . B.pack . show) >>= clientOff) |
50 (Exception.unblock $ listenLoop s chan ci >> return "Connection closed") `catch` (return . B.pack . show) >>= clientOff >> remove |
51 `Exception.finally` |
|
52 remove |
|
53 where |
51 where |
54 clientOff msg = writeChan chan $ ClientMessage (ci, ["QUIT", msg]) |
52 clientOff msg = writeChan chan $ ClientMessage (ci, ["QUIT", msg]) |
55 remove = writeChan chan $ Remove ci |
53 remove = writeChan chan $ Remove ci |
56 |
54 |
57 |
55 |