]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
add timeout to curio.open_connection()
authorBob Halley <halley@dnspython.org>
Fri, 12 Jun 2020 14:42:47 +0000 (07:42 -0700)
committerBob Halley <halley@dnspython.org>
Fri, 12 Jun 2020 14:42:47 +0000 (07:42 -0700)
dns/_curio_backend.py

index 2efd25db24d3a933ede8a3fe71170922fe954ff4..5f6877edcd9215278862003b1f12dc8997578966 100644 (file)
@@ -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}')