From be5e13671cdd923953d7b1b2137f06673fe7bb96 Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Thu, 26 Dec 2013 21:32:30 +0000 Subject: [PATCH] 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. --- lib/pure/asyncio.nim | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/pure/asyncio.nim b/lib/pure/asyncio.nim index c4a07d7513..3c2a5c17a4 100644 --- a/lib/pure/asyncio.nim +++ b/lib/pure/asyncio.nim @@ -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 = ""