gameServer/ClientIO.hs
changeset 4570 fa19f0579083
parent 4568 f85243bf890e
child 4904 0eab727d4717
equal deleted inserted replaced
4568:f85243bf890e 4570:fa19f0579083
    12 import CoreTypes
    12 import CoreTypes
    13 
    13 
    14 listenLoop :: Handle -> Int -> [String] -> Chan CoreMessage -> Int -> IO ()
    14 listenLoop :: Handle -> Int -> [String] -> Chan CoreMessage -> Int -> IO ()
    15 listenLoop handle linesNumber buf chan clientID = do
    15 listenLoop handle linesNumber buf chan clientID = do
    16     str <- liftM BUTF8.toString $ B.hGetLine handle
    16     str <- liftM BUTF8.toString $ B.hGetLine handle
    17     if (linesNumber > 50) || (length str > 450) then
    17     if (linesNumber > 50) || (length str > 20000) then
    18         writeChan chan $ ClientMessage (clientID, ["QUIT", "Protocol violation"])
    18         writeChan chan $ ClientMessage (clientID, ["QUIT", "Protocol violation"])
    19         else
    19         else
    20         if str == "" then do
    20         if str == "" then do
    21             writeChan chan $ ClientMessage (clientID, buf)
    21             writeChan chan $ ClientMessage (clientID, buf)
    22             yield
    22             yield