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