utils

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2019 License: LGPL-3.0 Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddrHandle

func AddrHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})

AddrHandle handles the neighbor address response message from peer

func AddrReqHandle

func AddrReqHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})

AddrReqHandle handles the neighbor address request from peer

func BlkHeaderHandle

func BlkHeaderHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})

BlkHeaderHandle handles the sync headers from peer

func BlockHandle

func BlockHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})

BlockHandle handles the block message from peer

func ConsensusHandle

func ConsensusHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})

ConsensusHandle handles the consensus message from peer

func DataReqHandle

func DataReqHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})

DataReqHandle handles the data req(block/Transaction) from peer

func DisconnectHandle

func DisconnectHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})

DisconnectHandle handles the disconnect events

func GetHeadersFromHash

func GetHeadersFromHash(startHash common.Uint256, stopHash common.Uint256) ([]*types.Header, error)

get blk hdrs from starthash to stophash

func HeadersReqHandle

func HeadersReqHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})

HeaderReqHandle handles the header sync req from peer

func InvHandle

func InvHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})

InvHandle handles the inventory message(block, transaction and consensus) from peer.

func NotFoundHandle

func NotFoundHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})

NotFoundHandle handles the not found message from peer

func PingHandle

func PingHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})

PingHandle handle ping msg from peer

func PongHandle

func PongHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})

/PongHandle handle pong msg from peer

func TransactionHandle

func TransactionHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})

TransactionHandle handles the transaction message from peer

func VerAckHandle

func VerAckHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})

VerAckHandle handles the version ack from peer

func VersionHandle

func VersionHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})

VersionHandle handles version handshake protocol from peer

Types

type MessageHandler

type MessageHandler func(data *types.MsgPayload, p2p p2p.P2P, pid *actor.PID, args ...interface{})

MessageHandler defines the unified api for each net message

type MessageRouter

type MessageRouter struct {
	RecvSyncChan chan *types.MsgPayload // The channel to handle sync msg
	RecvConsChan chan *types.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)

RegisterMsgHandler registers msg handler with the msg type

func (*MessageRouter) SetPID

func (this *MessageRouter) SetPID(pid *actor.PID)

SetPID sets p2p actor

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

Jump to

Keyboard shortcuts

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