summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
authorDominik Picheta <dominikpicheta@googlemail.com>2013-12-26 21:32:30 +0000
committerDominik Picheta <dominikpicheta@googlemail.com>2013-12-26 21:32:30 +0000
commitbe5e13671cdd923953d7b1b2137f06673fe7bb96 (patch)
tree11779693530d1730efb0e30f4b6bd5d8924caba4 /lib/pure
parent8c1ea5cb3f72901be47dc20366d228b0a1c9b417 (diff)
downloadNim-be5e13671cdd923953d7b1b2137f06673fe7bb96.tar.gz
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.
Diffstat (limited to 'lib/pure')
-rw-r--r--lib/pure/asyncio.nim7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/pure/asyncio.nim b/lib/pure/asyncio.nim
index c4a07d751..3c2a5c17a 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 = ""