mirror of https://github.com/vacp2p/nim-libp2p.git
properly close transport
This commit is contained in:
parent
a1ee339680
commit
f2fb92d1af
|
@ -47,11 +47,14 @@ method close*(t: TcpTransport): Future[void] {.async, gcsafe.} =
|
|||
await procCall Transport(t).close() # call base
|
||||
|
||||
t.server.stop()
|
||||
await t.server.closeWait()
|
||||
t.server.close()
|
||||
debug "transport stopped"
|
||||
|
||||
method listen*(t: TcpTransport,
|
||||
ma: MultiAddress,
|
||||
handler: ConnHandler):
|
||||
# TODO: need to check how this futures
|
||||
# are being returned, it doesn't seem to be right
|
||||
Future[Future[void]] {.async, gcsafe.} =
|
||||
discard await procCall Transport(t).listen(ma, handler) # call base
|
||||
|
||||
|
|
Loading…
Reference in New Issue