mirror of
https://github.com/smallnest/rpcx.git
synced 2025-09-26 20:21:14 +08:00
Merge pull request #868 from dickens7/feat-server-started
feat: add started chan
This commit is contained in:
@@ -129,6 +129,9 @@ type Server struct {
|
||||
ServerErrorFunc func(res *protocol.Message, err error) string
|
||||
|
||||
ViewManager *ViewManager
|
||||
|
||||
// The server is started.
|
||||
Started chan struct{}
|
||||
}
|
||||
|
||||
// NewServer returns a server.
|
||||
@@ -141,6 +144,7 @@ func NewServer(options ...OptionFn) *Server {
|
||||
serviceMap: make(map[string]*service),
|
||||
router: make(map[string]Handler),
|
||||
AsyncWrite: false, // 除非你想做进一步的优化测试,否则建议你设置为false
|
||||
Started: make(chan struct{}),
|
||||
}
|
||||
|
||||
for _, op := range options {
|
||||
@@ -268,6 +272,7 @@ func (s *Server) serveListener(ln net.Listener) error {
|
||||
|
||||
s.mu.Lock()
|
||||
s.ln = ln
|
||||
close(s.Started)
|
||||
s.mu.Unlock()
|
||||
|
||||
for {
|
||||
|
Reference in New Issue
Block a user