mirror of
https://github.com/status-im/nim-chronos.git
synced 2025-01-18 23:31:13 +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
|
||||
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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user