mirror of
https://github.com/libp2p/go-libp2p-core.git
synced 2025-04-28 17:10:14 +08:00
Merge pull request #6 from libp2p/update-connmgr-interface
add Close to ConnManager interface
This commit is contained in:
commit
3953b18150
connmgr
@ -60,6 +60,9 @@ type ConnManager interface {
|
||||
// The return value indicates whether the peer continues to be protected after this call, by way of a different tag.
|
||||
// See notes on Protect() for more info.
|
||||
Unprotect(id peer.ID, tag string) (protected bool)
|
||||
|
||||
// Close closes the connection manager and stops background processes
|
||||
Close() error
|
||||
}
|
||||
|
||||
// TagInfo stores metadata associated with a peer.
|
||||
|
@ -12,10 +12,12 @@ type NullConnMgr struct{}
|
||||
|
||||
var _ ConnManager = (*NullConnMgr)(nil)
|
||||
|
||||
func (_ NullConnMgr) TagPeer(peer.ID, string, int) {}
|
||||
func (_ NullConnMgr) UntagPeer(peer.ID, string) {}
|
||||
func (_ NullConnMgr) GetTagInfo(peer.ID) *TagInfo { return &TagInfo{} }
|
||||
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) TagPeer(peer.ID, string, int) {}
|
||||
func (_ NullConnMgr) UntagPeer(peer.ID, string) {}
|
||||
func (_ NullConnMgr) UpsertTag(peer.ID, string, func(int) int) {}
|
||||
func (_ NullConnMgr) GetTagInfo(peer.ID) *TagInfo { return &TagInfo{} }
|
||||
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) Close() error { return nil }
|
||||
|
Loading…
Reference in New Issue
Block a user