]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Do not try to set a future that is already set. [#572]
authorBob Halley <halley@dnspython.org>
Thu, 13 Aug 2020 15:08:19 +0000 (08:08 -0700)
committerBob Halley <halley@dnspython.org>
Thu, 13 Aug 2020 15:08:19 +0000 (08:08 -0700)
dns/_asyncio_backend.py

index 1cf15192fc402a6f6f476c9e0b9883181929a714..6a5633269b64a144d47fe9cfbdcd97df64900ce2 100644 (file)
@@ -30,11 +30,11 @@ class _DatagramProtocol:
             self.recvfrom = None
 
     def error_received(self, exc):  # pragma: no cover
-        if self.recvfrom:
+        if self.recvfrom and not self.recvfrom.done():
             self.recvfrom.set_exception(exc)
 
     def connection_lost(self, exc):
-        if self.recvfrom:
+        if self.recvfrom and not self.recvfrom.done():
             self.recvfrom.set_exception(exc)
 
     def close(self):