message

package
v0.0.0-...-7de8d3f Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2019 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMsgTimeout  = errors.New("msg timeout")
	ErrNodeOffline = errors.New("node offline")
	ErrPacketLost  = errors.New("packet lost")
)
View Source
var (
	PING      = metrics.PING
	PONG      = metrics.PONG
	FINDNODE  = metrics.FINDNODE
	NEIGHBORS = metrics.NEIGHBORS

	DEVP2P_HANDSHAKE = metrics.DEVP2P_HANDSHAKE
	DEVP2P_PING      = metrics.DEVP2P_PING
	DEVP2P_PONG      = metrics.DEVP2P_PONG

	STATUS_MSG            = metrics.STATUS_MSG
	NEW_BLOCK_HASHES_MSG  = metrics.NEW_BLOCK_HASHES_MSG
	TX_MSG                = metrics.TX_MSG
	GET_BLOCK_HEADERS_MSG = metrics.GET_BLOCK_HEADERS_MSG
	BLOCK_HEADERS_MSG     = metrics.BLOCK_HEADERS_MSG
	NEW_BLOCK_MSG         = metrics.NEW_BLOCK_MSG
)
View Source
var NetworkSpeed = 1024.0 * 400

Functions

func CalculateLatency

func CalculateLatency(content interface{}) float64

func CalculateSizeLatency

func CalculateSizeLatency(size common.StorageSize) float64

Types

type Message

type Message struct {
	godes.Runner
	Type    string
	Content interface{}
	From    INode
	To      INode

	Expiration float64

	ResponseTo *Message
	// contains filtered or unexported fields
}

func NewMessage

func NewMessage(
	from INode,
	to INode,
	msgType string,
	content interface{},
	expiration float64,
	handler func(m *Message),
	responseTo *Message,
	onResponse func(m *Message, err error),
	responseTimeout float64) (m *Message)

func (*Message) GetLatency

func (m *Message) GetLatency() float64

func (*Message) GetType

func (m *Message) GetType() string

func (*Message) HasExpired

func (m *Message) HasExpired() (expired bool)

func (*Message) Run

func (m *Message) Run()

func (*Message) Send

func (m *Message) Send()

func (*Message) String

func (m *Message) String() string

Jump to

Keyboard shortcuts

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