Documentation ¶
Index ¶
- func AddrHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})
- func AddrReqHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})
- func BlkHeaderHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})
- func BlockHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})
- func ConsensusHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})
- func DataReqHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})
- func DisconnectHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})
- func GetHeadersFromHash(startHash common.Uint256, stopHash common.Uint256) ([]*types.Header, error)
- func HeadersReqHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})
- func InvHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})
- func NotFoundHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})
- func PingHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})
- func PongHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})
- func TransactionHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})
- func VerAckHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})
- func VersionHandle(data *msgTypes.MsgPayload, p2p p2p.P2P, pid *evtActor.PID, args ...interface{})
- type MessageHandler
- type MessageRouter
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 ¶
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) UnRegisterMsgHandler ¶
func (this *MessageRouter) UnRegisterMsgHandler(key string)
UnRegisterMsgHandler un-registers the msg handler with the msg type