mirror of
https://github.com/status-im/nim-chronos.git
synced 2025-01-31 13:35:11 +00:00
Cleanup references on exit.
This commit is contained in:
parent
e19101d287
commit
417111093e
@ -95,6 +95,8 @@ proc tlsWriteLoop(stream: AsyncStreamWriter) {.async.} =
|
|||||||
await future
|
await future
|
||||||
except CancelledError:
|
except CancelledError:
|
||||||
discard
|
discard
|
||||||
|
finally:
|
||||||
|
wstream.stream = nil
|
||||||
|
|
||||||
proc tlsReadLoop(stream: AsyncStreamReader) {.async.} =
|
proc tlsReadLoop(stream: AsyncStreamReader) {.async.} =
|
||||||
var rstream = cast[TlsStreamReader](stream)
|
var rstream = cast[TlsStreamReader](stream)
|
||||||
@ -212,6 +214,7 @@ proc tlsReadLoop(stream: AsyncStreamReader) {.async.} =
|
|||||||
let item = wstream.queue.popFirstNoWait()
|
let item = wstream.queue.popFirstNoWait()
|
||||||
if not(item.future.finished()):
|
if not(item.future.finished()):
|
||||||
item.future.fail(rstream.error)
|
item.future.fail(rstream.error)
|
||||||
|
rstream.stream = nil
|
||||||
|
|
||||||
proc newTlsClientAsyncStream*(rsource: AsyncStreamReader,
|
proc newTlsClientAsyncStream*(rsource: AsyncStreamReader,
|
||||||
wsource: AsyncStreamWriter,
|
wsource: AsyncStreamWriter,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user