summaryrefslogtreecommitdiff
path: root/dns/asyncquery.py
diff options
context:
space:
mode:
authorBob Halley <halley@dnspython.org>2021-02-25 08:55:15 -0800
committerBob Halley <halley@dnspython.org>2021-02-25 08:55:15 -0800
commit5969ce9d22277f907ece5bddc4f02054fedd8734 (patch)
tree41fd2145847332f252ee3b62e5f0a174fb0fddc7 /dns/asyncquery.py
parentc249ca426bc43a5cd634387f8b0d09848fa9a169 (diff)
downloaddnspython-windows_asyncio_fix.tar.gz
asyncio on Windows requries connected sockets. [Issue #637]windows_asyncio_fix
Diffstat (limited to 'dns/asyncquery.py')
-rw-r--r--dns/asyncquery.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/dns/asyncquery.py b/dns/asyncquery.py
index 89c2622..0e353e8 100644
--- a/dns/asyncquery.py
+++ b/dns/asyncquery.py
@@ -142,7 +142,12 @@ async def udp(q, where, timeout=None, port=53, source=None, source_port=0,
if not backend:
backend = dns.asyncbackend.get_default_backend()
stuple = _source_tuple(af, source, source_port)
- s = await backend.make_socket(af, socket.SOCK_DGRAM, 0, stuple)
+ if backend.datagram_connection_required():
+ dtuple = (where, port)
+ else:
+ dtuple = None
+ s = await backend.make_socket(af, socket.SOCK_DGRAM, 0, stuple,
+ dtuple)
await send_udp(s, wire, destination, expiration)
(r, received_time, _) = await receive_udp(s, destination, expiration,
ignore_unexpected,