Skip to content

Commit

Permalink
trifle: remove useless field of server
Browse files Browse the repository at this point in the history
  • Loading branch information
panjf2000 committed May 2, 2020
1 parent 3cdc3c9 commit 47817a0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
3 changes: 0 additions & 3 deletions server_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ type server struct {
mainLoop *eventloop // main loop for accepting connections
eventHandler EventHandler // user eventHandler
subLoopGroup IEventLoopGroup // loops for handling events
subLoopGroupSize int // number of loops
}

// waitForShutdown waits for a signal to shutdown
Expand Down Expand Up @@ -97,7 +96,6 @@ func (svr *server) activateLoops(numEventLoop int) error {
return err
}
}
svr.subLoopGroupSize = svr.subLoopGroup.len()
// Start loops in background
svr.startLoops()
return nil
Expand All @@ -120,7 +118,6 @@ func (svr *server) activateReactors(numEventLoop int) error {
return err
}
}
svr.subLoopGroupSize = svr.subLoopGroup.len()
// Start sub reactors.
svr.startReactors()

Expand Down
6 changes: 2 additions & 4 deletions server_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ type server struct {
listenerWG sync.WaitGroup // listener close WaitGroup
eventHandler EventHandler // user eventHandler
subLoopGroup IEventLoopGroup // loops for handling events
subLoopGroupSize int // number of loops
}

// waitForShutdown waits for a signal to shutdown.
Expand Down Expand Up @@ -77,8 +76,7 @@ func (svr *server) startLoops(numEventLoop int) {
}
svr.subLoopGroup.register(el)
}
svr.subLoopGroupSize = svr.subLoopGroup.len()
svr.loopWG.Add(svr.subLoopGroupSize)
svr.loopWG.Add(svr.subLoopGroup.len())
svr.subLoopGroup.iterate(func(i int, el *eventloop) bool {
go el.loopRun()
return true
Expand All @@ -103,7 +101,7 @@ func (svr *server) stop() {
svr.loopWG.Wait()

// Close all connections.
svr.loopWG.Add(svr.subLoopGroupSize)
svr.loopWG.Add(svr.subLoopGroup.len())
svr.subLoopGroup.iterate(func(i int, el *eventloop) bool {
el.ch <- ErrCloseConns
return true
Expand Down

0 comments on commit 47817a0

Please sign in to comment.