From dd53732a01a4d70f03498d1eff13012fa0c03c7f Mon Sep 17 00:00:00 2001 From: Bob Halley Date: Fri, 12 Jun 2020 07:42:47 -0700 Subject: [PATCH] add timeout to curio.open_connection() --- dns/_curio_backend.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dns/_curio_backend.py b/dns/_curio_backend.py index 2efd25db..5f6877ed 100644 --- a/dns/_curio_backend.py +++ b/dns/_curio_backend.py @@ -86,10 +86,11 @@ class Backend(dns._asyncbackend.Backend): source_addr = (_lltuple(af, source)) else: source_addr = None - s = await curio.open_connection(destination[0], destination[1], - ssl=ssl_context, - source_addr=source_addr, - server_hostname=server_hostname) + async with _maybe_timeout(timeout): + s = await curio.open_connection(destination[0], destination[1], + ssl=ssl_context, + source_addr=source_addr, + server_hostname=server_hostname) return StreamSocket(s) raise NotImplementedError(f'unsupported socket type {socktype}') -- 2.47.3