mirror of
https://github.com/status-im/nim-websock.git
synced 2025-02-04 13:44:32 +00:00
avoid spin/live-lock on 0 bytes read
This commit is contained in:
parent
73edde4417
commit
5448b623bd
@ -399,6 +399,9 @@ proc recvMsg*(
|
||||
var buf = newSeq[byte](min(size, ws.frameSize))
|
||||
let read = await ws.recv(addr buf[0], buf.len)
|
||||
|
||||
if read <= 0:
|
||||
return res
|
||||
|
||||
buf.setLen(read)
|
||||
if res.len + buf.len > size:
|
||||
raise newException(WSMaxMessageSizeError, "Max message size exceeded")
|
||||
|
Loading…
x
Reference in New Issue
Block a user