Skip to content
This repository has been archived by the owner on Sep 6, 2022. It is now read-only.

Commit

Permalink
Adding ClosableTransport.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorropo committed Aug 27, 2020
1 parent b77fd28 commit b00396b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions transport/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,24 @@ type Transport interface {
Proxy() bool
}

// ClosableTransport is for transport that run a service beyond a listener
// (overlay networks, ...).
type ClosableTransport interface {
Transport

// Close is called when the libp2p node doesn't need the transport anymore.
// (libp2p closing, transport unhooked from a node, ...)
//
// Once a Close is called you can safely assume no more Dial or Listen are
// gonna be issued on this instance.
//
// If Close return an error the transport is still considered as dead
// (ex: transport already closed or transport never started).
//
// No more than one Close will ever be issued on an instance.
Close() error
}

// Listener is an interface closely resembling the net.Listener interface. The
// only real difference is that Accept() returns Conn's of the type in this
// package, and also exposes a Multiaddr method as opposed to a regular Addr
Expand Down

0 comments on commit b00396b

Please sign in to comment.