Skip to content

Commit

Permalink
Merge pull request #4872 from FreddieV96/master
Browse files Browse the repository at this point in the history
Added fix to recvAll that doesn't use signal (Left 0)
  • Loading branch information
melted committed Jun 6, 2020
2 parents 8ea1ec1 + 3d9e8b6 commit bf5431b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libs/contrib/Network/Socket.idr
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,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.
|||
Expand Down

0 comments on commit bf5431b

Please sign in to comment.