Version: v0.4.0 Latest Latest

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

Go to latest
Published: Apr 3, 2022 License: MIT Imports: 5 Imported by: 2




This section is empty.


View Source
var (
	DefaultPacketSize    = 65536
	DefaultBufferSize    = 4096
	DefaultTaskQueueSize = 1024


This section is empty.


type EventLoop

type EventLoop struct {
	// contains filtered or unexported fields

EventLoop 事件循环

func New

func New() (*EventLoop, error)

New 创建一个 EventLoop

func (*EventLoop) AddSocketAndEnableRead

func (l *EventLoop) AddSocketAndEnableRead(fd int, s Socket) error

AddSocketAndEnableRead 增加 Socket 到事件循环中,并注册可读事件

func (*EventLoop) ConnectionCount added in v0.2.1

func (l *EventLoop) ConnectionCount() int64

func (*EventLoop) DeleteFdInLoop

func (l *EventLoop) DeleteFdInLoop(fd int)

DeleteFdInLoop 删除 fd

func (*EventLoop) EnableRead

func (l *EventLoop) EnableRead(fd int) error

EnableRead 只注册可写事件

func (*EventLoop) EnableReadWrite

func (l *EventLoop) EnableReadWrite(fd int) error

EnableReadWrite 注册可读可写事件

func (*EventLoop) PacketBuf

func (l *EventLoop) PacketBuf() []byte

PacketBuf 内部使用,临时缓冲区

func (*EventLoop) QueueInLoop

func (l *EventLoop) QueueInLoop(f func())

QueueInLoop 添加 func 到事件循环中执行

func (*EventLoop) Run added in v0.4.0

func (l *EventLoop) Run()

Run 启动事件循环

func (*EventLoop) Stop

func (l *EventLoop) Stop() error

Stop 关闭事件循环

type Socket

type Socket interface {
	HandleEvent(fd int, events poller.Event)
	Close() error

Socket 接口

Source Files

Jump to

Keyboard shortcuts

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