aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2019-10-04 09:44:58 +0100
committerGravatar GitHub <noreply@github.com> 2019-10-04 09:44:58 +0100
commit03ea2ae955823612da2e3b2ebf21da7ab8eea1bd (patch)
tree8b140512f8000f4d2042ad43a3dd5e8e301a3328 /plugin
parentf8551df27284b93e9f95e064ec65a9df60f4a528 (diff)
downloadcoredns-03ea2ae955823612da2e3b2ebf21da7ab8eea1bd.tar.gz
coredns-03ea2ae955823612da2e3b2ebf21da7ab8eea1bd.tar.zst
coredns-03ea2ae955823612da2e3b2ebf21da7ab8eea1bd.zip
Make request.Request smaller (#3351)
* Make request.Request smaller This makes the request struct smaller and removes the pointer to the do boolean (tri-bool) as size == 0 will indicate if we have cached it. Family can be a int8 because it only carries 3 values, Size itself is just a uint16 under the covers. This is a more comprehensive fix than #3292 Closes #3292 Signed-off-by: Miek Gieben <miek@miek.nl> * cache: fix test this now needs a valid response writter Signed-off-by: Miek Gieben <miek@miek.nl>
Diffstat (limited to 'plugin')
-rw-r--r--plugin/cache/cache_test.go2
-rw-r--r--plugin/pkg/edns/edns.go2
2 files changed, 2 insertions, 2 deletions
diff --git a/plugin/cache/cache_test.go b/plugin/cache/cache_test.go
index 4afaf73c4..b32353372 100644
--- a/plugin/cache/cache_test.go
+++ b/plugin/cache/cache_test.go
@@ -191,7 +191,7 @@ func TestCache(t *testing.T) {
m := tc.in.Msg()
m = cacheMsg(m, tc)
- state := request.Request{W: nil, Req: m}
+ state := request.Request{W: &test.ResponseWriter{}, Req: m}
mt, _ := response.Typify(m, utc)
valid, k := key(state.Name(), m, mt, state.Do())
diff --git a/plugin/pkg/edns/edns.go b/plugin/pkg/edns/edns.go
index 68fb03865..31f57ea9b 100644
--- a/plugin/pkg/edns/edns.go
+++ b/plugin/pkg/edns/edns.go
@@ -63,7 +63,7 @@ func Version(req *dns.Msg) (*dns.Msg, error) {
}
// Size returns a normalized size based on proto.
-func Size(proto string, size int) int {
+func Size(proto string, size uint16) uint16 {
if proto == "tcp" {
return dns.MaxMsgSize
}