aboutsummaryrefslogtreecommitdiff
path: root/plugin/forward/persistent.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/forward/persistent.go')
-rw-r--r--plugin/forward/persistent.go37
1 files changed, 8 insertions, 29 deletions
diff --git a/plugin/forward/persistent.go b/plugin/forward/persistent.go
index 6ea4d0371..2f488e485 100644
--- a/plugin/forward/persistent.go
+++ b/plugin/forward/persistent.go
@@ -31,25 +31,18 @@ type transport struct {
dial chan string
yield chan connErr
ret chan connErr
-
- // Aid in testing, gets length of cache in data-race safe manner.
- lenc chan bool
- lencOut chan int
-
- stop chan bool
+ stop chan bool
}
func newTransport(addr string, tlsConfig *tls.Config) *transport {
t := &transport{
- conns: make(map[string][]*persistConn),
- expire: defaultExpire,
- addr: addr,
- dial: make(chan string),
- yield: make(chan connErr),
- ret: make(chan connErr),
- stop: make(chan bool),
- lenc: make(chan bool),
- lencOut: make(chan int),
+ conns: make(map[string][]*persistConn),
+ expire: defaultExpire,
+ addr: addr,
+ dial: make(chan string),
+ yield: make(chan connErr),
+ ret: make(chan connErr),
+ stop: make(chan bool),
}
go t.connManager()
return t
@@ -65,13 +58,6 @@ func (t *transport) len() int {
return l
}
-// Len returns the number of connections in the cache.
-func (t *transport) Len() int {
- t.lenc <- true
- l := <-t.lencOut
- return l
-}
-
// connManagers manages the persistent connection cache for UDP and TCP.
func (t *transport) connManager() {
@@ -128,13 +114,6 @@ Wait:
case <-t.stop:
return
-
- case <-t.lenc:
- l := 0
- for _, conns := range t.conns {
- l += len(conns)
- }
- t.lencOut <- l
}
}
}