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

Connection Manager: add IsProtected interface #158

Merged
merged 1 commit into from
Jun 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions connmgr/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions connmgr/null.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 }