mirror of
https://github.com/coredns/coredns.git
synced 2025-11-27 06:04:03 -05:00
Failed startup was not flagged (#118)
The error propagation from srv.ListenAndServe did not work as intended, simplified it a bit and added a test for it.
This commit is contained in:
@@ -163,8 +163,8 @@ func (s *Server) Serve(ln ListenerFile) error {
|
||||
// ListenAndServe starts the server with a new listener. It blocks until the server stops.
|
||||
func (s *Server) ListenAndServe() error {
|
||||
err := s.setup()
|
||||
defer close(s.startChan)
|
||||
if err != nil {
|
||||
close(s.startChan)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -187,8 +187,6 @@ func (s *Server) ListenAndServe() error {
|
||||
go func() {
|
||||
s.server[0].ActivateAndServe()
|
||||
}()
|
||||
|
||||
close(s.startChan) // unblock anyone waiting for this to start listening
|
||||
return s.server[1].ActivateAndServe()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user