properly close transport

This commit is contained in:
Dmitriy Ryajov 2019-09-12 18:56:32 -06:00
parent a1ee339680
commit f2fb92d1af
1 changed files with 4 additions and 1 deletions

View File

@ -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