From afacbc776aa2156b522d6c969288caf630f6e9ec Mon Sep 17 00:00:00 2001 From: Jorropo Date: Thu, 27 Aug 2020 15:53:40 +0200 Subject: [PATCH] Adding doc about Closable Transport. --- transport/transport.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/transport/transport.go b/transport/transport.go index 39a8fd38..739c8ba3 100644 --- a/transport/transport.go +++ b/transport/transport.go @@ -54,6 +54,15 @@ type CapableConn interface { // CapableConn, which means that they have been upgraded to support // stream multiplexing and connection security (encryption and authentication). // +// If your transport implements `io.Closer` Close will be called when libp2p +// closes. +// +// Close need to be threadsafe with Dial and Listen. +// You might receive calls to Dial or Listen even once closed, they should +// error. +// +// If Close return an error the transport is still considered as dead. +// // For a conceptual overview, see https://docs.libp2p.io/concepts/transport/ type Transport interface { // Dial dials a remote peer. It should try to reuse local listener