Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFuncQueue ¶
func NewFuncQueue(initlen, maxlen int) *funcqueue
Types ¶
type Conn ¶
type Conn interface { SetCtx(ctx interface{}) GetCtx() (ctx interface{}) //当前连接运行的 loopid GetLoopid() int //从loop上移除 Detach() error LocalAddr() string RemoteAddr() string //socket读写缓存大小 SetReadBuffer(bytes int) error SetWriteBuffer(bytes int) error //socket opt SetLinger(sec int) error SetKeepAlivePeriod(sec, probes int) error SetNoDelay(nodelay bool) error Close() error Watch(canread, canwrite bool) error Read(buf []byte) (int, error) Write(buf []byte) (int, error) }
type Engine ¶
type Engine interface { LoopNum() int AddTask(loopid int, call func(loopid int)) error AddService(svrid int, call func(svrid int, err error), evhandle EvHandler, opts ...SvrOption) error StartService(svrid int, call func(svrid int, err error)) error StopService(svrid int, call func(svrid int, err error)) error DelService(svrid int, call func(svrid int, err error)) error //not thread safe AddToService(loopid, svrid int, conn Conn) error }
type LoadBalance ¶
type LoadBalance int
const ( LoadBalanceRR LoadBalance = iota //轮询 LoadBalanceLC //最少连接 LoadBalanceSAH //源地址哈希 )
type SvrOption ¶
type SvrOption func(*svroption)
func WithListenbacklog ¶
func WithLoadBalance ¶
func WithLoadBalance(value LoadBalance) SvrOption
func WithProtoAddr ¶
func WithReuseAddr ¶
func WithReusePort ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.