mirror of https://github.com/vacp2p/nim-libp2p.git
close connection on chronos close
This commit is contained in:
parent
46daed9a38
commit
5158d96eaf
|
@ -16,6 +16,12 @@ logScope:
|
||||||
type ChronosStream* = ref object of LPStream
|
type ChronosStream* = ref object of LPStream
|
||||||
client: StreamTransport
|
client: StreamTransport
|
||||||
|
|
||||||
|
proc onTransportClose(s: ChronosStream,
|
||||||
|
client: StreamTransport) {.async.} =
|
||||||
|
await client.join()
|
||||||
|
trace "Transport closed, closing connection"
|
||||||
|
await s.close()
|
||||||
|
|
||||||
proc newChronosStream*(client: StreamTransport): ChronosStream =
|
proc newChronosStream*(client: StreamTransport): ChronosStream =
|
||||||
new result
|
new result
|
||||||
result.client = client
|
result.client = client
|
||||||
|
|
Loading…
Reference in New Issue