Browse Source

connmgr: add IsProtected interface (#158)

pull/1683/head
vyzo 4 years ago
committed by GitHub
parent
commit
5f96bc70f4
  1. 4
      core/connmgr/manager.go
  2. 1
      core/connmgr/null.go

4
core/connmgr/manager.go

@ -70,6 +70,10 @@ type ConnManager interface {
// See notes on Protect() for more info.
Unprotect(id peer.ID, tag string) (protected bool)
// IsProtected returns true if the peer is protected for some tag; if the tag is the empty string
// then it will return true if the peer is protected for any tag
IsProtected(id peer.ID, tag string) (protected bool)
// Close closes the connection manager and stops background processes.
Close() error
}

1
core/connmgr/null.go

@ -20,4 +20,5 @@ func (_ NullConnMgr) TrimOpenConns(ctx context.Context) {}
func (_ NullConnMgr) Notifee() network.Notifiee { return network.GlobalNoopNotifiee }
func (_ NullConnMgr) Protect(peer.ID, string) {}
func (_ NullConnMgr) Unprotect(peer.ID, string) bool { return false }
func (_ NullConnMgr) IsProtected(peer.ID, string) bool { return false }
func (_ NullConnMgr) Close() error { return nil }

Loading…
Cancel
Save