eventloop

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

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

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CLOSE_BY_ACCEPT = errors.New("BY_ACCEPT")
View Source
var CLOSE_BY_ANTI_IDLE = errors.New("BY_ANTI_IDLE")
View Source
var CLOSE_BY_CLOSE_CMD = errors.New("BY_CLOSE_CMD")
View Source
var CLOSE_BY_DUP_ACCEPT = errors.New("BY_DUP_ACCEPT")
View Source
var CLOSE_BY_SLOW_READER = errors.New("BY_SLOW_READER")
View Source
var CLOSE_BY_USER_LAND = errors.New("BY_USER_LAND")
View Source
var CLOSE_EPOLL_ERR = errors.New("EPOLL_ERROR")
View Source
var CLOSE_MEM_ALLOC_FAIL = errors.New("MEM_ALLOC_FAIL")
View Source
var CLOSE_PKT_PARSE_ERR = errors.New("PKT_PARSE_ERROR")
View Source
var CLOSE_PKT_SIZE_LIMIT = errors.New("PKT_SIZE_LIMIT")
View Source
var CLOSE_READ_ERR = errors.New("READ_ERROR")
View Source
var CLOSE_SEND_ERR = errors.New("SEND_ERROR")

Functions

func InitFDTable

func InitFDTable()

Types

type CmdData

type CmdData struct {
	// contains filtered or unexported fields
}

type IDGenerator

type IDGenerator interface {
	GetID() uint64
}

type IEVEndpoint

type IEVEndpoint interface {
	net.Addr
	IsReuse() bool
	GetContext() interface{}
}

type IEVLoop

type IEVLoop interface {
	Init(idx, size, chansize, pktsizelimit, cliSbufLimit int)
	AddListener(l IListener)
	Run()
	SetWg(wg *sync.WaitGroup)
	SetHandler(h IHandler)
	SetSelector(s ISelector)
	AddClient(c connection.EngineConn) error
	AllocID(c connection.EngineConn)
	SetPollWait(int)
	Online() int32
	DialCnt() int32
	SyncTime(int64, int64)
	SetIDGen(IDGenerator)

	Stop()
	Stat(int64, bool)
	Id() int
}

type IHandler

type IHandler interface {
	OnReady(s IServer)
	OnClosed(c connection.AppConn, err error)
	OnConnected(c connection.ProtoConn)
	Stat(bool)
}

type IListener

type IListener interface {
	Fd() int
	TlsMode() int
	TlsConfig() *tls.Config
	Addr() net.Addr
	ListenAddr() string
	GetEndpoint() IEVEndpoint
	Close()
}

type ISelector

type ISelector interface {
	SelectLoop(id int) IEVLoop
	GetLoad() int32
}

type IServer

type IServer interface {
	GetListenAddrs() []net.Addr
	GetWorkerNum() int
}

type LoopConn

type LoopConn struct {
	// contains filtered or unexported fields
}

func (*LoopConn) AddClient

func (l *LoopConn) AddClient(c connection.EngineConn) error

func (*LoopConn) AddCmd

func (l *LoopConn) AddCmd(cmd, fd int, dial bool, id uint64, data []byte) error

func (*LoopConn) AddListener

func (l *LoopConn) AddListener(lis IListener)

func (*LoopConn) AllocID

func (l *LoopConn) AllocID(c connection.EngineConn)

func (*LoopConn) DialCnt

func (l *LoopConn) DialCnt() int32

func (*LoopConn) GenID

func (l *LoopConn) GenID(seed int) uint64

func (*LoopConn) Id

func (l *LoopConn) Id() int

func (*LoopConn) Init

func (l *LoopConn) Init(idx, size, chanSize, pktSizeLimit, cliSbufLimit int)

func (*LoopConn) Online

func (l *LoopConn) Online() int32

func (*LoopConn) Run

func (l *LoopConn) Run()

func (*LoopConn) SetCheck

func (l *LoopConn) SetCheck(interval, limit int64)

func (*LoopConn) SetHandler

func (l *LoopConn) SetHandler(h IHandler)

func (*LoopConn) SetIDGen

func (l *LoopConn) SetIDGen(gen IDGenerator)

func (*LoopConn) SetMax

func (l *LoopConn) SetMax(max int32)

func (*LoopConn) SetPollWait

func (l *LoopConn) SetPollWait(msec int)

func (*LoopConn) SetSelector

func (l *LoopConn) SetSelector(s ISelector)

func (*LoopConn) SetTLSWorker

func (l *LoopConn) SetTLSWorker(worker *TLSHandshakeWorker)

func (*LoopConn) SetWg

func (l *LoopConn) SetWg(wg *sync.WaitGroup)

func (*LoopConn) Stat

func (l *LoopConn) Stat(now int64, print bool)

func (*LoopConn) Stop

func (l *LoopConn) Stop()

func (*LoopConn) SyncTime

func (l *LoopConn) SyncTime(sec int64, msec int64)

type TLSHandshakeWorker

type TLSHandshakeWorker struct {
	// contains filtered or unexported fields
}

func NewTLSHandshakeWorker

func NewTLSHandshakeWorker(maxWorkers int, loops []IEVLoop) *TLSHandshakeWorker

func (*TLSHandshakeWorker) Pending

func (w *TLSHandshakeWorker) Pending() int32

func (*TLSHandshakeWorker) Start

func (w *TLSHandshakeWorker) Start()

func (*TLSHandshakeWorker) Stats

func (w *TLSHandshakeWorker) Stats() (pending int32, maxWorkers, workers, idleWorkers int)

func (*TLSHandshakeWorker) Stop

func (w *TLSHandshakeWorker) Stop()

func (*TLSHandshakeWorker) Submit

Jump to

Keyboard shortcuts

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