netpoll

package
v0.0.0-...-435a7a5 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// InitEvents represents the initial length of poller event-list.
	InitEvents = 128
	// ErrEvents represents exceptional events that are not read/write, like socket being closed,
	// reading/writing from/to a closed socket, etc.
	ErrEvents = unix.EPOLLERR | unix.EPOLLHUP | unix.EPOLLRDHUP
	// OutEvents combines EPOLLOUT event and some exceptional events.
	OutEvents = ErrEvents | unix.EPOLLOUT
	// InEvents combines EPOLLIN/EPOLLPRI events and some exceptional events.
	InEvents = ErrEvents | unix.EPOLLIN | unix.EPOLLPRI
)

Variables

This section is empty.

Functions

func SetKeepAlive

func SetKeepAlive(fd, secs int) error

SetKeepAlive sets the keepalive for the connection.

func SocketAddrToTCPOrUnixAddr

func SocketAddrToTCPOrUnixAddr(sa unix.Sockaddr) net.Addr

func SocketAddrToUDPAddr

func SocketAddrToUDPAddr(sa unix.Sockaddr) *net.UDPAddr

Types

type Poller

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

func CreatePoller

func CreatePoller() (*Poller, error)

CreatePoller instantiates a poller.

func (*Poller) AddRead

func (p *Poller) AddRead(fd int) error

AddRead registers the given file-descriptor with readable event to the poller.

func (*Poller) AddWrite

func (p *Poller) AddWrite(fd int) error

func (*Poller) Close

func (p *Poller) Close() error

func (*Poller) Delete

func (p *Poller) Delete(fd int) error

func (*Poller) ModRead

func (p *Poller) ModRead(fd int) error

func (*Poller) ModReadWrite

func (p *Poller) ModReadWrite(fd int) error

func (*Poller) Polling

func (p *Poller) Polling(callback func(fd int, ev uint32) error) (err error)

func (*Poller) Trigger

func (p *Poller) Trigger(w asyncwork.Work) error

Jump to

Keyboard shortcuts

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