Skip to content

Commit

Permalink
Merge pull request #351 from guonaihong/fix
Browse files Browse the repository at this point in the history
fix不停返回EV_ADD事件
  • Loading branch information
lesismal authored Sep 18, 2023
2 parents 1eb1c5f + fae73d1 commit 21f3f04
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions poller_kqueue.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ 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()
}

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()
}
Expand Down Expand Up @@ -218,7 +218,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
Expand Down Expand Up @@ -308,5 +308,4 @@ func newPoller(g *Engine, isListener bool, index int) (*poller, error) {
}

func (c *Conn) ResetPollerEvent() {

}

0 comments on commit 21f3f04

Please sign in to comment.