summary refs log tree commit diff stats
path: root/lib/pure/asyncdispatch.nim
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pure/asyncdispatch.nim')
-rw-r--r--lib/pure/asyncdispatch.nim6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/pure/asyncdispatch.nim b/lib/pure/asyncdispatch.nim
index 8336da1fb..8c4a0e41d 100644
--- a/lib/pure/asyncdispatch.nim
+++ b/lib/pure/asyncdispatch.nim
@@ -132,7 +132,7 @@ export Port, SocketFlag
 ##        # Handle exception
 ##
 ## Unfortunately the semantics of the try statement may not always be correct,
-## and occassionally the compilation may fail altogether.
+## and occasionally the compilation may fail altogether.
 ## As such it is better to use the former style when possible.
 ##
 ## Discarding futures
@@ -1055,7 +1055,7 @@ else:
         # so that exceptions can be raised from `send(...)` and
         # `recv(...)` routines.
 
-        if EvRead in info.events:
+        if EvRead in info.events or info.events == {EvError}:
           # Callback may add items to ``data.readCBs`` which causes issues if
           # we are iterating over ``data.readCBs`` at the same time. We therefore
           # make a copy to iterate over.
@@ -1066,7 +1066,7 @@ else:
               # Callback wants to be called again.
               data.readCBs.add(cb)
 
-        if EvWrite in info.events:
+        if EvWrite in info.events or info.events == {EvError}:
           let currentCBs = data.writeCBs
           data.writeCBs = @[]
           for cb in currentCBs: