Skip to content

Commit 3d9e8b6

Browse files
committed
Added fix to recvAll that doesn't use signal (Left 0)
1 parent f975b45 commit 3d9e8b6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

libs/contrib/Network/Socket.idr

+3-3
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,10 @@ recvAll sock = recvRec sock [] 64
178178
recvRec : Socket -> List String -> ByteLength -> IO (Either SocketError String)
179179
recvRec sock acc n = do res <- recv sock n
180180
case res of
181-
Left 0 => pure (Right $ concat $ reverse acc)
182181
Left c => pure (Left c)
183-
Right (str, _) => let n' = min (n * 2) 65536 in
184-
recvRec sock (str :: acc) n'
182+
Right (str, res) => let n' = min (n * 2) 65536 in
183+
if res < n then pure (Right $ concat $ reverse $ str :: acc)
184+
else recvRec sock (str :: acc) n'
185185

186186
||| Send a message.
187187
|||

0 commit comments

Comments
 (0)