Skip to content

Commit

Permalink
feat: patch by @teamgram
Browse files Browse the repository at this point in the history
  • Loading branch information
wubenqi committed Jun 1, 2024
1 parent 54954b1 commit 77149bc
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions gnet_teamgram.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,21 @@ func (e Engine) Trigger(connId int64, cb func(c Conn)) {
return true
})
}

// Iterate - iterate all conns
func (e Engine) Iterate(cb func(c Conn)) {
if e.Validate() != nil {
return
}

e.eng.eventLoops.iterate(func(_ int, el *eventloop) bool {
_ = el.poller.Trigger(queue.LowPriority, func(_ interface{}) error {
el.connections.iterate(func(c *conn) bool {
cb(c)
return true
})
return nil
}, nil)
return true
})
}

0 comments on commit 77149bc

Please sign in to comment.