summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
authorRuslan Mustakov <r.mustakov@gmail.com>2017-12-30 15:41:41 +0700
committerAndreas Rumpf <rumpf_a@web.de>2017-12-30 10:27:31 +0100
commit3073f08e4857b14a6bd1b0022fe45f461bf88171 (patch)
treeb54ff854a6796306af1de83d8cfdcd10905eb277 /lib/pure
parent29db57a804e03ac4d9d943ac7cf3966777fa5c8d (diff)
downloadNim-3073f08e4857b14a6bd1b0022fe45f461bf88171.tar.gz
Add hasPendingOperations check to asyncdispatch.drain
Diffstat (limited to 'lib/pure')
-rw-r--r--lib/pure/asyncdispatch.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/pure/asyncdispatch.nim b/lib/pure/asyncdispatch.nim
index b62cf2e9b..42ffa236c 100644
--- a/lib/pure/asyncdispatch.nim
+++ b/lib/pure/asyncdispatch.nim
@@ -1487,7 +1487,7 @@ proc drain*(timeout = 500) =
   ## if there are no pending operations. In contrast to ``poll`` this
   ## processes as many events as are available.
   if runOnce(timeout):
-    while runOnce(0): discard
+    while hasPendingOperations() and runOnce(0): discard
 
 proc poll*(timeout = 500) =
   ## Waits for completion events and processes them. Raises ``ValueError``