Fix possible crash in tcptransport when server is nil

This commit is contained in:
Giovanni Petrantoni 2020-04-06 12:56:17 +09:00
parent 3514733060
commit f7af2c2e5c
1 changed files with 4 additions and 2 deletions

View File

@ -50,6 +50,8 @@ method close*(t: TcpTransport): Future[void] {.async, gcsafe.} =
trace "stopping transport"
await procCall Transport(t).close() # call base
# server can be nil
if t.server != nil:
t.server.stop()
t.server.close()
trace "transport stopped"