Documentation
¶
Index ¶
- type CloseCallback
- type Connection
- func (c *Connection) Connected() bool
- func (c *Connection) Context() interface{}
- func (c *Connection) HandleEvent(fd int, events poller.Event)
- func (c *Connection) PeerAddr() string
- func (c *Connection) Send(buffer []byte) error
- func (c *Connection) SetContext(ctx interface{})
- func (c *Connection) ShutdownWrite() error
- type ReadCallback
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection TCP 连接
func New ¶
func New(fd int, loop *eventloop.EventLoop, sa *unix.Sockaddr, readCb ReadCallback, closeCb CloseCallback) *Connection
New 创建 Connection
func (*Connection) HandleEvent ¶
func (c *Connection) HandleEvent(fd int, events poller.Event)
HandleEvent 内部使用,event loop 回调
func (*Connection) SetContext ¶
func (c *Connection) SetContext(ctx interface{})
SetContext 设置 Context
func (*Connection) ShutdownWrite ¶
func (c *Connection) ShutdownWrite() error
ShutdownWrite 关闭可写端,等待读取完接收缓冲区所有数据
type ReadCallback ¶
type ReadCallback func(c *Connection, buffer *ringbuffer.RingBuffer) []byte
ReadCallback 数据可读回调函数
Click to show internal directories.
Click to hide internal directories.