From 0a6e3ec9c822abb783af322f7ff57a82baafca74 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Fri, 2 Aug 2019 13:54:05 -0400 Subject: [PATCH] Correct addrs sorting to be by TCP/UDP Fixes any potential cases where the resolver might yield UDP addresses first. Signed-off-by: Robbie Harwood --- kdcproxy/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kdcproxy/__init__.py b/kdcproxy/__init__.py index abba1df..d26312d 100644 --- a/kdcproxy/__init__.py +++ b/kdcproxy/__init__.py @@ -227,7 +227,8 @@ def __call__(self, env, start_response): # # Stick a None address on the end so we can get one # more attempt after all servers have been contacted. - addrs = tuple(sorted(filter(self.__filter_addr, addrs))) + addrs = tuple(sorted(filter(self.__filter_addr, addrs), + key=lambda a: a[2])) for addr in addrs + (None,): if addr is not None: # Bypass unspecified socktypes