diff --git a/libp2p/stream/chronosstream.nim b/libp2p/stream/chronosstream.nim index 2a4bf3a..4cc9213 100644 --- a/libp2p/stream/chronosstream.nim +++ b/libp2p/stream/chronosstream.nim @@ -95,15 +95,10 @@ method write*(s: ChronosStream, msg: seq[byte], msglen = -1) {.async, gcsafe.} = method close*(s: ChronosStream) {.async, gcsafe.} = if not s.closed: - trace "closing connection for", address = $s.client.remoteAddress() - if not s.reader.closed: - await s.reader.closeWait() - + trace "shutting down server", address = $s.client.remoteAddress() await s.writer.finish() - if not s.writer.closed: - await s.writer.closeWait() + await s.writer.closeWait() + await s.reader.closeWait() + await s.client.closeWait() - if not s.client.closed: - await s.client.closeWait() - s.closed = true diff --git a/libp2p/transports/tcptransport.nim b/libp2p/transports/tcptransport.nim index 83ff4cf..6845d66 100644 --- a/libp2p/transports/tcptransport.nim +++ b/libp2p/transports/tcptransport.nim @@ -67,6 +67,7 @@ method listen*(t: TcpTransport, # always get the resolved address in case we're bound to 0.0.0.0:0 t.ma = t.server.sock.getLocalAddress().toMultiAddr() result = t.server.join() + trace "started node on", address = t.ma method dial*(t: TcpTransport, address: MultiAddress): diff --git a/libp2p/transports/transport.nim b/libp2p/transports/transport.nim index 8b4af30..1e196cd 100644 --- a/libp2p/transports/transport.nim +++ b/libp2p/transports/transport.nim @@ -8,7 +8,7 @@ ## those terms. import sequtils -import chronos +import chronos, chronicles import ../peerinfo, ../connection, ../multiaddress, @@ -47,6 +47,7 @@ method listen*(t: Transport, ## listen for incoming connections t.ma = ma t.handler = handler + debug "starting node", address = $ma method dial*(t: Transport, address: MultiAddress):