Assertion and bugfix. (#397)
This commit is contained in:
parent
36ab9c8e4a
commit
6523f741a6
|
@ -222,6 +222,7 @@ proc finish(fut: FutureBase, state: FutureState) =
|
|||
# 1. `finish()` is a private procedure and `state` is under our control.
|
||||
# 2. `fut.state` is checked by `checkFinished()`.
|
||||
fut.state = state
|
||||
doAssert fut.cancelcb == nil or state != FutureState.Cancelled
|
||||
fut.cancelcb = nil # release cancellation callback memory
|
||||
for item in fut.callbacks.mitems():
|
||||
if not(isNil(item.function)):
|
||||
|
|
|
@ -961,7 +961,7 @@ proc join*(rw: AsyncStreamRW): Future[void] =
|
|||
|
||||
if not(rw.future.finished()):
|
||||
rw.future.addCallback(continuation, cast[pointer](retFuture))
|
||||
rw.future.cancelCallback = cancellation
|
||||
retFuture.cancelCallback = cancellation
|
||||
else:
|
||||
retFuture.complete()
|
||||
|
||||
|
|
Loading…
Reference in New Issue