Remove assert in asyncio which causes problems.

This assert keeps failing occassionally in nimbuild causing it to crash.
According to logic it shouldn't, but perhaps the socket's writeable
status changes.
This commit is contained in:
Dominik Picheta
2013-12-26 21:32:30 +00:00
parent 8c1ea5cb3f
commit be5e13671c

View File

@@ -233,8 +233,11 @@ proc asyncSockHandleWrite(h: PObject) =
let sock = PAsyncSocket(h)
try:
let bytesSent = sock.socket.sendAsync(sock.sendBuffer)
assert bytesSent > 0
if bytesSent != sock.sendBuffer.len:
if bytesSent == 0:
# Apparently the socket cannot be written to. Even though select
# just told us that it can be... This used to be an assert. Just
# do nothing instead.
elif bytesSent != sock.sendBuffer.len:
sock.sendBuffer = sock.sendBuffer[bytesSent .. -1]
elif bytesSent == sock.sendBuffer.len:
sock.sendBuffer = ""