diff --git a/poller_kqueue.go b/poller_kqueue.go index 5a38d4a3..3cee88d0 100644 --- a/poller_kqueue.go +++ b/poller_kqueue.go @@ -103,7 +103,7 @@ func (p *poller) trigger() { func (p *poller) addRead(fd int) { p.mux.Lock() - p.eventList = append(p.eventList, syscall.Kevent_t{Ident: uint64(fd), Flags: syscall.EV_ADD, Filter: syscall.EVFILT_READ}) + p.eventList = append(p.eventList, syscall.Kevent_t{Ident: uint64(fd), Flags: syscall.EV_ADD | syscall.EV_CLEAR, Filter: syscall.EVFILT_READ}) p.mux.Unlock() p.trigger() } @@ -117,7 +117,7 @@ func (p *poller) resetRead(fd int) { func (p *poller) modWrite(fd int) { p.mux.Lock() - p.eventList = append(p.eventList, syscall.Kevent_t{Ident: uint64(fd), Flags: syscall.EV_ADD, Filter: syscall.EVFILT_WRITE}) + p.eventList = append(p.eventList, syscall.Kevent_t{Ident: uint64(fd), Flags: syscall.EV_ADD | syscall.EV_CLEAR, Filter: syscall.EVFILT_WRITE}) p.mux.Unlock() p.trigger() } @@ -229,7 +229,7 @@ func (p *poller) readWriteLoop() { defer runtime.UnlockOSThread() } - var events = make([]syscall.Kevent_t, 1024) + events := make([]syscall.Kevent_t, 1024) var changes []syscall.Kevent_t p.shutdown = false @@ -319,5 +319,4 @@ func newPoller(g *Engine, isListener bool, index int) (*poller, error) { } func (c *Conn) ResetPollerEvent() { - }