Browse Source

doc: ensure nobody tries to add teardown logic to the host close function again

pull/669/head
Steven Allen 5 years ago
parent
commit
428d7135a5
  1. 7
      p2p/host/basic/basic_host.go

7
p2p/host/basic/basic_host.go

@ -747,6 +747,13 @@ func (h *BasicHost) AllAddrs() []ma.Multiaddr {
// Close shuts down the Host's services (network, etc).
func (h *BasicHost) Close() error {
// You're thinking of adding some teardown logic here, right? Well
// don't! Add any process teardown logic to the teardown function in the
// constructor.
//
// This:
// 1. May be called multiple times.
// 2. May _never_ be called if the host is stopped by the context.
return h.proc.Close()
}

Loading…
Cancel
Save