mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 16:24:19 -04:00
plugin/forward: move Dial goroutine out (#1738)
Rework the TestProxyClose - close the proxy in the *same* goroutine as where we started it. Close channels as long as we don't get dataraces (this may need another fix). Move the Dial goroutine out of the connManager - this simplifies things *and* makes another goroutine go away and removes the need for connErr channels - can now just be dns.Conn. Also: Revert "plugin/forward: gracefull stop (#1701)" This reverts commit135377bf77. Revert "rework TestProxyClose (#1735)" This reverts commit9e8893a0b5.
This commit is contained in:
@@ -34,16 +34,6 @@ func (p *Proxy) updateRtt(newRtt time.Duration) {
|
||||
}
|
||||
|
||||
func (p *Proxy) connect(ctx context.Context, state request.Request, forceTCP, metric bool) (*dns.Msg, error) {
|
||||
atomic.AddInt32(&p.inProgress, 1)
|
||||
defer func() {
|
||||
if atomic.AddInt32(&p.inProgress, -1) == 0 {
|
||||
p.checkStopTransport()
|
||||
}
|
||||
}()
|
||||
if atomic.LoadUint32(&p.state) != running {
|
||||
return nil, errStopped
|
||||
}
|
||||
|
||||
start := time.Now()
|
||||
|
||||
proto := state.Proto()
|
||||
@@ -55,6 +45,7 @@ func (p *Proxy) connect(ctx context.Context, state request.Request, forceTCP, me
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Set buffer size correctly for this client.
|
||||
conn.UDPSize = uint16(state.Size())
|
||||
if conn.UDPSize < 512 {
|
||||
|
||||
Reference in New Issue
Block a user