p2p

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2020 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type P2PServer

type P2PServer struct {
	iservices.IP2P
	Network p2p.P2P

	ReconnectAddrs
	// contains filtered or unexported fields
}

P2PServer control all network activities

func NewServer

func NewServer(ctx *node.ServiceContext, lg *logrus.Logger) (*P2PServer, error)

NewServer return a new p2pserver according to the pubkey

func (*P2PServer) Broadcast

func (this *P2PServer) Broadcast(message interface{})

func (*P2PServer) FetchMissingBlock added in v1.0.3

func (this *P2PServer) FetchMissingBlock(localHeadID, targetID coomn.BlockID)

func (*P2PServer) FetchUnlinkedBlock added in v1.0.2

func (this *P2PServer) FetchUnlinkedBlock(prevId coomn.BlockID)

func (*P2PServer) GetMockLatency added in v1.0.2

func (this *P2PServer) GetMockLatency() int

func (*P2PServer) GetNodeNeighbours added in v1.0.2

func (this *P2PServer) GetNodeNeighbours() string

func (*P2PServer) RandomSend added in v1.0.2

func (this *P2PServer) RandomSend(message interface{})

func (*P2PServer) RequestCheckpoint added in v1.0.2

func (this *P2PServer) RequestCheckpoint(startNum, endNum uint64)

func (*P2PServer) Send

func (this *P2PServer) Send(p *peer.Peer, msg msgtypes.Message,
	isConsensus bool) error

Send tranfer buffer to peer

func (*P2PServer) SendToPeer added in v1.0.2

func (this *P2PServer) SendToPeer(p *peer.Peer, message interface{})

func (*P2PServer) SetMockLatency added in v1.0.2

func (this *P2PServer) SetMockLatency(t int)

func (*P2PServer) Start

func (this *P2PServer) Start(node *node.Node) error

Start create all services

func (*P2PServer) Stop

func (this *P2PServer) Stop() error

Stop halt all service by send signal to channels

func (*P2PServer) TriggerSync

func (this *P2PServer) TriggerSync(current_head_blk_id coomn.BlockID)

type ReconnectAddrs

type ReconnectAddrs struct {
	sync.RWMutex
	RetryAddrs map[string]int
}

ReconnectAddrs contain addr need to reconnect

Directories

Path Synopsis
message
net

Jump to

Keyboard shortcuts

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