utils

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxBlockQueriesPerSecond      = 1500
	MaxCheckPointQueriesPerSecond = 1500
	MaxBlobSizePerSecond          = 10 * 1024 * 1024
)

Variables

This section is empty.

Functions

func ExtractBlockID added in v1.0.2

func ExtractBlockID(commit *message.Commit) common.BlockID

Types

type MessageHandler

type MessageHandler func(data *msgTypes.MsgPayload, p2p p2p.P2P, args ...interface{})

MessageHandler defines the unified api for each net message

type MessageRouter

type MessageRouter struct {
	RecvSyncChan chan *msgTypes.MsgPayload // The channel to handle sync msg
	RecvConsChan chan *msgTypes.MsgPayload // The channel to handle consensus msg
	// contains filtered or unexported fields
}

MessageRouter mostly route different message type-based to the related message handler

func NewMsgRouter

func NewMsgRouter(p2p p2p.P2P) *MessageRouter

NewMsgRouter returns a message router object

func (*MessageRouter) RegisterMsgHandler

func (this *MessageRouter) RegisterMsgHandler(key string,
	handler MessageHandler)

func (*MessageRouter) RegisterSyncMsgHandler added in v1.0.2

func (this *MessageRouter) RegisterSyncMsgHandler(key string,
	handler MessageHandler)

RegisterMsgHandler registers msg handler with the msg type

func (*MessageRouter) Start

func (this *MessageRouter) Start()

Start starts the loop to handle the message from the network

func (*MessageRouter) Stop

func (this *MessageRouter) Stop()

Stop stops the message router's loop

func (*MessageRouter) UnRegisterMsgHandler

func (this *MessageRouter) UnRegisterMsgHandler(key string)

UnRegisterMsgHandler un-registers the msg handler with the msg type

type MsgHandler added in v1.0.2

type MsgHandler struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewMsgHandler added in v1.0.2

func NewMsgHandler() *MsgHandler

func (*MsgHandler) AddrHandle added in v1.0.2

func (p *MsgHandler) AddrHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, args ...interface{})

AddrHandle handles the neighbor address response message from peer

func (*MsgHandler) AddrReqHandle added in v1.0.2

func (p *MsgHandler) AddrReqHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, args ...interface{})

AddrReqHandle handles the neighbor address request from peer

func (*MsgHandler) BlockSyncHandle added in v1.0.2

func (p *MsgHandler) BlockSyncHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, args ...interface{})

func (*MsgHandler) ClearOutOfRangeStateHandle added in v1.0.2

func (p *MsgHandler) ClearOutOfRangeStateHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, args ...interface{})

func (*MsgHandler) ConsMsgHandle added in v1.0.2

func (p *MsgHandler) ConsMsgHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, args ...interface{})

func (*MsgHandler) DetectFormerIdsHandle added in v1.0.2

func (p *MsgHandler) DetectFormerIdsHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, args ...interface{})

func (*MsgHandler) DisconnectHandle added in v1.0.2

func (p *MsgHandler) DisconnectHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, args ...interface{})

DisconnectHandle handles the disconnect events

func (*MsgHandler) FetchOutOfRangeHandle added in v1.0.2

func (p *MsgHandler) FetchOutOfRangeHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, args ...interface{})

func (*MsgHandler) IdMsgHandle added in v1.0.2

func (p *MsgHandler) IdMsgHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, args ...interface{})

func (*MsgHandler) PingHandle added in v1.0.2

func (p *MsgHandler) PingHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, args ...interface{})

PingHandle handle ping msg from peer

func (*MsgHandler) PongHandle added in v1.0.2

func (p *MsgHandler) PongHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, args ...interface{})

/PongHandle handle pong msg from peer

func (*MsgHandler) ReqIdHandle added in v1.0.2

func (p *MsgHandler) ReqIdHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, args ...interface{})

func (*MsgHandler) RequestBlockBatchHandle added in v1.0.2

func (p *MsgHandler) RequestBlockBatchHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, args ...interface{})

func (*MsgHandler) RequestCheckpointBatchHandle added in v1.0.2

func (p *MsgHandler) RequestCheckpointBatchHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, args ...interface{})

func (*MsgHandler) TransactionHandle added in v1.0.2

func (p *MsgHandler) TransactionHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, args ...interface{})

TransactionHandle handles the transaction message from peer

func (*MsgHandler) VerAckHandle added in v1.0.2

func (p *MsgHandler) VerAckHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, args ...interface{})

VerAckHandle handles the version ack from peer

func (*MsgHandler) VersionHandle added in v1.0.2

func (p *MsgHandler) VersionHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, args ...interface{})

VersionHandle handles version handshake protocol from peer

Jump to

Keyboard shortcuts

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