diff --git a/graphite/graphite_tcp.go b/graphite/graphite_tcp.go index c29bb41f63..b3ea382933 100644 --- a/graphite/graphite_tcp.go +++ b/graphite/graphite_tcp.go @@ -52,9 +52,13 @@ func (t *TCPServer) ListenAndServe(iface string) error { defer t.wg.Done() for { conn, err := ln.Accept() + if opErr, ok := err.(*net.OpError); ok && !opErr.Temporary() { + t.Logger.Println("graphite TCP listener closed") + return + } if err != nil { t.Logger.Println("error accepting TCP connection", err.Error()) - return + continue } t.wg.Add(1) diff --git a/opentsdb/opentsdb.go b/opentsdb/opentsdb.go index 600f6ae504..16f7e2175e 100644 --- a/opentsdb/opentsdb.go +++ b/opentsdb/opentsdb.go @@ -73,9 +73,13 @@ func (s *Server) ListenAndServe(listenAddress string) { defer s.wg.Done() for { conn, err := s.listener.Accept() + if opErr, ok := err.(*net.OpError); ok && !opErr.Temporary() { + log.Println("openTSDB TCP listener closed") + return + } if err != nil { log.Println("error accepting openTSDB: ", err.Error()) - return + continue } s.wg.Add(1) go s.HandleConnection(conn)