mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 16:24:19 -04:00
This reverts commit 604a902e2c.
This commit is contained in:
@@ -7,7 +7,6 @@ package proxy
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"io"
|
"io"
|
||||||
"net"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
@@ -118,20 +117,11 @@ func (p *Proxy) Connect(ctx context.Context, state request.Request, opts Options
|
|||||||
for {
|
for {
|
||||||
ret, err = pc.c.ReadMsg()
|
ret, err = pc.c.ReadMsg()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// For UDP, if the error is not a network error keep waiting for a valid response to prevent malformed
|
pc.c.Close() // not giving it back
|
||||||
// spoofs from blocking the upstream response.
|
|
||||||
// In the case this is a legitimate malformed response from the upstream, this will result in a timeout.
|
|
||||||
if proto == "udp" {
|
|
||||||
if _, ok := err.(net.Error); !ok {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pc.c.Close() // connection closed by peer, close the persistent connection
|
|
||||||
if err == io.EOF && cached {
|
if err == io.EOF && cached {
|
||||||
return nil, ErrCachedClosed
|
return nil, ErrCachedClosed
|
||||||
}
|
}
|
||||||
|
// recovery the origin Id after upstream.
|
||||||
// recover the origin Id after upstream.
|
|
||||||
if ret != nil {
|
if ret != nil {
|
||||||
ret.Id = originId
|
ret.Id = originId
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user