Documentation ¶
Index ¶
- Constants
- Variables
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) CouldBeDisconnected() bool
- func (c *Conn) CouldBeReadable() bool
- func (c *Conn) CouldBeWritable() bool
- func (c *Conn) Fd() int
- func (c *Conn) LocalAddr() net.Addr
- func (c *Conn) OnDisconnected()
- func (c *Conn) OnReadable()
- func (c *Conn) OnWritable()
- func (c *Conn) Read(b []byte) (n int, err error)
- func (c *Conn) RemoteAddr() net.Addr
- func (c *Conn) SetDeadline(t time.Time) error
- func (c *Conn) SetReadDeadline(t time.Time) error
- func (c *Conn) SetWriteDeadline(t time.Time) error
- func (c *Conn) WithOnDisconnected(ondisconnect func(c *Conn))
- func (c *Conn) WithOnReadable(onread func(c *Conn))
- func (c *Conn) WithOnWritable(onwrite func(c *Conn))
- func (c *Conn) Write(b []byte) (n int, err error)
- type Epoll
- type EpollEvent
- type Queue
Constants ¶
View Source
const ( DEFAULT_EVENTS_SIZE = 1024 EPOLLET = 0x80000000 )
Variables ¶
View Source
var ( ErrEvents = fmt.Errorf("invald events") ErrConn = fmt.Errorf("invalid net.conn") ErrEventsExist = fmt.Errorf("the event existed") ErrEventsNonExist = fmt.Errorf("the event doesn't exist") ErrEpollAdd = fmt.Errorf("epoll_ctl_add fail") ErrEpollMod = fmt.Errorf("epoll_ctl_mod fail") ErrEpollDel = fmt.Errorf("epoll_ctl_del fail") )
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
func NewConnWithFd ¶ added in v0.0.2
func (*Conn) CouldBeDisconnected ¶ added in v0.0.3
func (*Conn) CouldBeReadable ¶ added in v0.0.3
protect each R/W goroutine A goroutine is still reading, don't interrupt It happens that a goroutine try to read many times. However, the event will be triggered twice.
func (*Conn) CouldBeWritable ¶ added in v0.0.3
func (*Conn) OnDisconnected ¶
func (c *Conn) OnDisconnected()
func (*Conn) OnReadable ¶
func (c *Conn) OnReadable()
func (*Conn) OnWritable ¶
func (c *Conn) OnWritable()
func (*Conn) RemoteAddr ¶
func (*Conn) WithOnDisconnected ¶
func (*Conn) WithOnReadable ¶
func (*Conn) WithOnWritable ¶
type EpollEvent ¶
type EpollEvent int
const ( EVENT_READABLE EpollEvent = iota EVENT_WRITABLE EVENT_DISCONNECTED EVENT_EDGE_TRIGGERED )
type Queue ¶ added in v0.0.6
type Queue struct {
// contains filtered or unexported fields
}
func (*Queue) DisconnectSchedule ¶ added in v0.0.6
func (q *Queue) DisconnectSchedule(f func())
func (*Queue) ReadSchedule ¶ added in v0.0.6
func (q *Queue) ReadSchedule(f func())
func (*Queue) WriteSchedule ¶ added in v0.0.6
func (q *Queue) WriteSchedule(f func())
Click to show internal directories.
Click to hide internal directories.