mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-25 04:33:45 +03:00
Added fix to recvAll that doesn't use signal (Left 0) but the size of the buffer
This commit is contained in:
parent
8af183d52b
commit
2f34f85e2f
@ -173,10 +173,10 @@ recvAll sock = recvRec sock [] 64
|
||||
recvRec : Socket -> List String -> ByteLength -> IO (Either SocketError String)
|
||||
recvRec sock acc n = do res <- recv sock n
|
||||
case res of
|
||||
Left 0 => pure (Right $ concat $ reverse acc)
|
||||
Left c => pure (Left c)
|
||||
Right (str, _) => let n' = min (n * 2) 65536 in
|
||||
recvRec sock (str :: acc) n'
|
||||
Right (str, res) => let n' = min (n * 2) 65536 in
|
||||
if res < n then pure (Right $ concat $ reverse $ str :: acc)
|
||||
else recvRec sock (str :: acc) n'
|
||||
|
||||
||| Send a message.
|
||||
|||
|
||||
|
Loading…
Reference in New Issue
Block a user