use pkg/reuseport in rest plugins (#3492)

Automatically submitted.
This commit is contained in:
Zou Nengren
2019-12-06 18:55:40 +08:00
committed by corbot[bot]
parent af1fe4172a
commit 13fca02316
3 changed files with 11 additions and 6 deletions

View File

@@ -10,6 +10,7 @@ import (
"github.com/coredns/coredns/plugin"
"github.com/coredns/coredns/plugin/metrics/vars"
"github.com/coredns/coredns/plugin/pkg/reuseport"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
@@ -95,7 +96,7 @@ func (m *Metrics) ZoneNames() []string {
// OnStartup sets up the metrics on startup.
func (m *Metrics) OnStartup() error {
ln, err := net.Listen("tcp", m.Addr)
ln, err := reuseport.Listen("tcp", m.Addr)
if err != nil {
log.Errorf("Failed to start metrics handler: %s", err)
return err