]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Tweak the _get_cookie() method
authorMichał Kępień <michal@isc.org>
Thu, 21 May 2026 09:52:56 +0000 (11:52 +0200)
committerMichał Kępień <michal@isc.org>
Thu, 21 May 2026 09:52:56 +0000 (11:52 +0200)
The "len(cookie.server) == 0" condition is superfluous for the
"resend_loop" system test, so remove it.  Add a return type annotation
to the _get_cookie() function.

bin/tests/system/resend_loop/ans3/ans.py

index 2b8cf4d01818cef5c3a409f912ef54fce65cb9b5..9dcdec83b53554b0c766d621ad3b68615c075919 100644 (file)
@@ -28,13 +28,11 @@ from isctest.asyncserver import (
 )
 
 
-def _get_cookie(qctx: QueryContext):
+def _get_cookie(qctx: QueryContext) -> dns.edns.CookieOption | None:
     for o in qctx.query.options:
         if o.otype == dns.edns.OptionType.COOKIE:
             cookie = o
-            if len(cookie.server) == 0:
-                cookie.server = b"\x11\x22\x33\x44\x55\x66\x77\x88"
-
+            cookie.server = b"\x11\x22\x33\x44\x55\x66\x77\x88"
             return cookie
 
     return None