Tweak the _get_cookie() method

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.
This commit is contained in:
Michał Kępień 2026-05-21 11:52:56 +02:00
parent c9ceb191e8
commit 5fa2bd7e53
No known key found for this signature in database

View 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