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