forked from luyu6056/gnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreactor_bsd.go
More file actions
30 lines (23 loc) · 763 Bytes
/
Copy pathreactor_bsd.go
File metadata and controls
30 lines (23 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright 2019 Andy Pan. All rights reserved.
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file.
// +build darwin netbsd freebsd openbsd dragonfly
package gnet
func (svr *server) activateMainReactor() {
defer svr.signalShutdown()
sniffError(svr.mainLoop.poller.Polling(func(fd int, filter int16) error {
return svr.acceptNewConnection(fd)
}))
}
func (svr *server) activateSubReactor(lp *eventloop) {
defer svr.signalShutdown()
if lp.idx == 0 && svr.opts.Ticker {
go lp.loopTicker()
}
sniffError(lp.poller.Polling(func(fd int, filter int16) error {
if c := lp.connections[fd/lp.svr.subLoopGroup.len()]; c != nil && c.state == connStateOk {
return lp.loopIn(c)
}
return nil
}))
}