From cf478b0aedcbb1d9293a33e8a7e5adbfe14c24fb Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Tue, 14 Jan 2020 10:56:09 +0100 Subject: [PATCH] more Signed-off-by: Miek Gieben --- plugin/traffic/xds/client.go | 3 ++- plugin/traffic/xds/v2client.go | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plugin/traffic/xds/client.go b/plugin/traffic/xds/client.go index a8836aacf..152b2ac58 100644 --- a/plugin/traffic/xds/client.go +++ b/plugin/traffic/xds/client.go @@ -23,6 +23,7 @@ package xds import ( "errors" "fmt" + "time" "github.com/coredns/coredns/plugin/traffic/xds/bootstrap" @@ -79,7 +80,7 @@ func New(opts Options) (*Client, error) { c := &Client{ opts: opts, cc: cc, - v2c: newV2Client(cc, opts.Config.NodeProto, nil), // todo re-add backoff (exponential) + v2c: newV2Client(cc, opts.Config.NodeProto, func(int) time.Duration { return 0 }), } return c, nil } diff --git a/plugin/traffic/xds/v2client.go b/plugin/traffic/xds/v2client.go index 40215e40c..9dfe83eb1 100644 --- a/plugin/traffic/xds/v2client.go +++ b/plugin/traffic/xds/v2client.go @@ -115,7 +115,7 @@ func (v2c *v2Client) run() { } if retries != 0 { - t := time.NewTimer(1 * time.Second) // backoff bla bla. + t := time.NewTimer(v2c.backoff(retries)) select { case <-t.C: case <-v2c.ctx.Done(): @@ -165,6 +165,7 @@ func (v2c *v2Client) sendRequest(stream adsStream, resourceNames []string, typeU ResponseNonce: nonce, // TODO: populate ErrorDetails for nack. } + println("v2: sendrequest", typeURL) if err := stream.Send(req); err != nil { log.Warningf("xds: request (type %s) for resource %v failed: %v", typeURL, resourceNames, err) return false @@ -180,6 +181,7 @@ func (v2c *v2Client) sendRequest(stream adsStream, resourceNames []string, typeU // quickly (once it pushes the message onto the transport layer) and is only // ever blocked if we don't have enough flow control quota. func (v2c *v2Client) sendExisting(stream adsStream) bool { + println("v2: sendexisting") v2c.mu.Lock() defer v2c.mu.Unlock()