From 417111093e20baa407faf9ca2ae6d07d3425f982 Mon Sep 17 00:00:00 2001 From: cheatfate Date: Tue, 8 Oct 2019 20:38:39 +0300 Subject: [PATCH] Cleanup references on exit. --- chronos/streams/tlsstream.nim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/chronos/streams/tlsstream.nim b/chronos/streams/tlsstream.nim index dec9720c..bffdde14 100644 --- a/chronos/streams/tlsstream.nim +++ b/chronos/streams/tlsstream.nim @@ -95,6 +95,8 @@ proc tlsWriteLoop(stream: AsyncStreamWriter) {.async.} = await future except CancelledError: discard + finally: + wstream.stream = nil proc tlsReadLoop(stream: AsyncStreamReader) {.async.} = var rstream = cast[TlsStreamReader](stream) @@ -212,6 +214,7 @@ proc tlsReadLoop(stream: AsyncStreamReader) {.async.} = let item = wstream.queue.popFirstNoWait() if not(item.future.finished()): item.future.fail(rstream.error) + rstream.stream = nil proc newTlsClientAsyncStream*(rsource: AsyncStreamReader, wsource: AsyncStreamWriter,