From: Bob Halley Date: Fri, 12 Jun 2020 14:42:47 +0000 (-0700) Subject: add timeout to curio.open_connection() X-Git-Tag: v2.0.0rc1~112^2~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd53732a01a4d70f03498d1eff13012fa0c03c7f;p=thirdparty%2Fdnspython.git add timeout to curio.open_connection() --- 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}')