diff --git a/server.go b/server.go index bb32586..e3e9ece 100644 --- a/server.go +++ b/server.go @@ -287,8 +287,13 @@ func (s *Server) connect(upstream *Upstream) error { func (s *Server) Run() { for i := range s.Upstreams { + upstream := &s.Upstreams[i] // TODO: retry connecting - go s.connect(&s.Upstreams[i]) + go func() { + if err := s.connect(upstream); err != nil { + s.Logger.Printf("Failed to connect to upstream server %q: %v", upstream.Addr, err) + } + }() } }