gameServer/ClientIO.hs
changeset 4982 3572eaf14340
parent 4932 f11d80bac7ed
child 4996 76ef3d8bd78e
equal deleted inserted replaced
4981:0c60ade27a0a 4982:3572eaf14340
    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