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

@ -3,6 +3,8 @@ package dnstest
import (
"net"
"github.com/coredns/coredns/plugin/pkg/reuseport"
"github.com/miekg/dns"
)
@ -27,7 +29,7 @@ func NewServer(f dns.HandlerFunc) *Server {
s2 := &dns.Server{} // tcp
for i := 0; i < 5; i++ { // 5 attempts
s2.Listener, _ = net.Listen("tcp", ":0")
s2.Listener, _ = reuseport.Listen("tcp", ":0")
if s2.Listener == nil {
continue
}