check for monitor server start error

This commit is contained in:
Andy Xie
2019-07-05 18:18:52 +08:00
parent 94071d32a9
commit c9221fd187

View File

@@ -1471,7 +1471,14 @@ func (s *Server) startMonitoring(secure bool) error {
s.mu.Unlock()
go func() {
srv.Serve(httpListener)
if err := srv.Serve(httpListener); err != nil {
s.mu.Lock()
shutdown := s.shutdown
s.mu.Unlock()
if !shutdown {
s.Fatalf("Error starting monitor on %q: %v", hp, err)
}
}
srv.Handler = nil
s.mu.Lock()
s.httpHandler = nil