fix socket backend to stop looping when not receiving data
a endless loop would occur when empty of data is received
This commit is contained in:
parent
619d05f80f
commit
beb4e7c67d
1 changed files with 3 additions and 1 deletions
|
@ -50,7 +50,9 @@ instance HasBackend Socket where
|
|||
where loop 0 = return []
|
||||
loop left = do
|
||||
r <- Socket.recv sock left
|
||||
liftM (r:) (loop (left - B.length r))
|
||||
if B.null r
|
||||
then return []
|
||||
else liftM (r:) (loop (left - B.length r))
|
||||
|
||||
instance HasBackend Handle where
|
||||
initializeBackend handle = hSetBuffering handle NoBuffering
|
||||
|
|
Loading…
Reference in a new issue