node

package
v0.3.1-alpha Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2018 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxBufLen   = 1024 * 16       // maximum buffer to receive message
	DialTimeout = 3 * time.Second // timeout for dialing
)
View Source
const (
	MaxSyncHeaderReq     = 2                // max concurrent sync header request count
	MaxMsgChanNum        = 2048             // max goroutine num for message handler
	ConnectionMaxBackoff = 4000             // back off for retry
	MaxRetryCount        = 3                // max retry count
	KeepAliveTicker      = 3 * time.Second  // ticker for ping/pong and keepalive message
	KeepaliveTimeout     = 9 * time.Second  // timeout for keeping alive
	BlockSyncingTicker   = 3 * time.Second  // ticker for syncing block
	ProtocolVersion      = 0                // protocol version
	ConnectionTicker     = 10 * time.Second // ticker for connection
	MaxReqBlkOnce        = 16               // max block count requested
	ConnectingTimeout    = 10 * time.Second // timeout for waiting for connection
)
View Source
const (
	HashCacheCap = 1000
)

Variables

This section is empty.

Functions

func InitNode

func InitNode(pubKey *crypto.PubKey, ring *chord.Ring) Noder

func NewHashCache

func NewHashCache(cap int) *hashCache

func NewNode

func NewNode() *node

func NonTLSDial

func NonTLSDial(nodeAddr string) (net.Conn, error)

func TLSDial

func TLSDial(nodeAddr string) (net.Conn, error)

Types

type ChanQueue

type ChanQueue chan struct{}

func MakeChanQueue

func MakeChanQueue(n int) ChanQueue

type ConnectingNodes

type ConnectingNodes struct {
	sync.RWMutex
	ConnectingAddrs []string
}

type RetryConnAddrs

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

Jump to

Keyboard shortcuts

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