Skip to content

Commit

Permalink
Merge pull request #868 from dickens7/feat-server-started
Browse files Browse the repository at this point in the history
feat: add started chan
  • Loading branch information
smallnest authored Jul 26, 2024
2 parents 4310c44 + 638c688 commit 6663fb7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 6663fb7

Please sign in to comment.