equal
deleted
inserted
replaced
36 listenLoop :: Socket -> Chan CoreMessage -> ClientIndex -> IO () |
36 listenLoop :: Socket -> Chan CoreMessage -> ClientIndex -> IO () |
37 listenLoop sock chan ci = recieveWithBufferLoop B.empty |
37 listenLoop sock chan ci = recieveWithBufferLoop B.empty |
38 where |
38 where |
39 recieveWithBufferLoop recvBuf = do |
39 recieveWithBufferLoop recvBuf = do |
40 recvBS <- recv sock 4096 |
40 recvBS <- recv sock 4096 |
41 -- putStrLn $ show sock ++ " got smth: " ++ (show $ B.length recvBS) |
|
42 unless (B.null recvBS) $ do |
41 unless (B.null recvBS) $ do |
43 let (packets, newrecvBuf) = bs2Packets $ B.append recvBuf recvBS |
42 let (packets, newrecvBuf) = bs2Packets $ B.append recvBuf recvBS |
44 forM_ packets sendPacket |
43 forM_ packets sendPacket |
45 recieveWithBufferLoop newrecvBuf |
44 recieveWithBufferLoop newrecvBuf |
46 |
45 |