]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
use clock time not trio time
authorBob Halley <halley@dnspython.org>
Thu, 21 May 2020 13:58:17 +0000 (06:58 -0700)
committerBob Halley <halley@dnspython.org>
Thu, 21 May 2020 13:58:24 +0000 (06:58 -0700)
dns/trio/query.py

index 0fc605842affd58723bc3b032e9092f5c6990b66..e7e79a523ed4ca4e0c955ca646675530a3e310dd 100644 (file)
@@ -4,6 +4,7 @@
 
 import socket
 import struct
+import time
 import trio
 import trio.socket  # type: ignore
 
@@ -38,7 +39,7 @@ async def send_udp(sock, what, destination):
 
     if isinstance(what, dns.message.Message):
         what = what.to_wire()
-    sent_time = trio.current_time()
+    sent_time = time.time()
     n = await sock.sendto(what, destination)
     return (n, sent_time)
 
@@ -84,7 +85,7 @@ async def receive_udp(sock, destination, ignore_unexpected=False,
             raise UnexpectedSource('got a response from '
                                    '%s instead of %s' % (from_address,
                                                          destination))
-    received_time = trio.current_time()
+    received_time = time.time()
     r = dns.message.from_wire(wire, keyring=keyring, request_mac=request_mac,
                               one_rr_per_rrset=one_rr_per_rrset,
                               ignore_trailing=ignore_trailing)
@@ -159,7 +160,7 @@ async def send_stream(stream, what):
     # avoid writev() or doing a short write that would get pushed
     # onto the net
     stream_message = struct.pack("!H", l) + what
-    sent_time = trio.current_time()
+    sent_time = time.time()
     await stream.send_all(stream_message)
     return (len(stream_message), sent_time)
 
@@ -201,7 +202,7 @@ async def receive_stream(stream, one_rr_per_rrset=False, keyring=None,
     ldata = await _read_exactly(stream, 2)
     (l,) = struct.unpack("!H", ldata)
     wire = await _read_exactly(stream, l)
-    received_time = trio.current_time()
+    received_time = time.time()
     r = dns.message.from_wire(wire, keyring=keyring, request_mac=request_mac,
                               one_rr_per_rrset=one_rr_per_rrset,
                               ignore_trailing=ignore_trailing)
@@ -260,7 +261,7 @@ async def stream(q, where, tls=False, port=None, source=None, source_port=0,
         dns.query._destination_and_source(None, where, port, source,
                                           source_port)
     with socket_factory(af, socket.SOCK_STREAM, 0) as s:
-        begin_time = trio.current_time()
+        begin_time = time.time()
         if source is not None:
             await s.bind(source)
         await s.connect(destination)