connectionMonitor

package
v1.0.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DurationBetweenReconnectAttempts = time.Second * 5

DurationBetweenReconnectAttempts is used as to not call reconnecter.ReconnectToNetwork() too often when there are a lot of peers disconnecting and reconnection to initial nodes succeeds

Functions

func NewLibp2pConnectionMonitorSimple

func NewLibp2pConnectionMonitorSimple(args ArgsConnectionMonitorSimple) (*libp2pConnectionMonitorSimple, error)

NewLibp2pConnectionMonitorSimple creates a new connection monitor (version 2 that is more streamlined and does not care about pausing and resuming the discovery process)

Types

type ArgsConnectionMonitorSimple

type ArgsConnectionMonitorSimple struct {
	Reconnecter                p2p.Reconnecter
	ThresholdMinConnectedPeers uint32
	Sharder                    Sharder
	PreferredPeersHolder       p2p.PreferredPeersHolderHandler
	ConnectionsWatcher         p2p.ConnectionsWatcher
}

ArgsConnectionMonitorSimple is the DTO used in the NewLibp2pConnectionMonitorSimple constructor function

type Sharder

type Sharder interface {
	ComputeEvictionList(pidList []peer.ID) []peer.ID
	Has(pid peer.ID, list []peer.ID) bool
	SetSeeders(addresses []string)
	IsSeeder(pid core.PeerID) bool
	IsInterfaceNil() bool
}

Sharder defines the eviction computing process of unwanted peers

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL