From 41a1b9f5fada65a63cdc094f9be3a0c36404cbe0 Mon Sep 17 00:00:00 2001 From: juanvallejo Date: Mon, 6 Aug 2018 15:34:54 -0400 Subject: [PATCH] UPSTREAM: 67024: add CancelRequest to discovery round-tripper --- .../src/k8s.io/client-go/discovery/round_tripper.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/vendor/k8s.io/kubernetes/staging/src/k8s.io/client-go/discovery/round_tripper.go b/vendor/k8s.io/kubernetes/staging/src/k8s.io/client-go/discovery/round_tripper.go index 2e352b888f29..23cf8f4fc157 100644 --- a/vendor/k8s.io/kubernetes/staging/src/k8s.io/client-go/discovery/round_tripper.go +++ b/vendor/k8s.io/kubernetes/staging/src/k8s.io/client-go/discovery/round_tripper.go @@ -21,6 +21,7 @@ import ( "net/http" "path/filepath" + "github.com/golang/glog" "github.com/gregjones/httpcache" "github.com/gregjones/httpcache/diskcache" "github.com/peterbourgon/diskv" @@ -48,4 +49,15 @@ func (rt *cacheRoundTripper) RoundTrip(req *http.Request) (*http.Response, error return rt.rt.RoundTrip(req) } +func (rt *cacheRoundTripper) CancelRequest(req *http.Request) { + type canceler interface { + CancelRequest(*http.Request) + } + if cr, ok := rt.rt.Transport.(canceler); ok { + cr.CancelRequest(req) + } else { + glog.Errorf("CancelRequest not implemented by %T", rt.rt.Transport) + } +} + func (rt *cacheRoundTripper) WrappedRoundTripper() http.RoundTripper { return rt.rt.Transport }