mirror of https://github.com/vacp2p/nim-libp2p.git
Fix possible crash in tcptransport when server is nil
This commit is contained in:
parent
3514733060
commit
f7af2c2e5c
|
@ -50,8 +50,10 @@ method close*(t: TcpTransport): Future[void] {.async, gcsafe.} =
|
|||
trace "stopping transport"
|
||||
await procCall Transport(t).close() # call base
|
||||
|
||||
t.server.stop()
|
||||
t.server.close()
|
||||
# server can be nil
|
||||
if t.server != nil:
|
||||
t.server.stop()
|
||||
t.server.close()
|
||||
trace "transport stopped"
|
||||
|
||||
method listen*(t: TcpTransport,
|
||||
|
|
Loading…
Reference in New Issue