]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Fix setup race condition in nanoquic.
authorBob Halley <halley@dnspython.org>
Sun, 18 Jun 2023 15:24:29 +0000 (08:24 -0700)
committerBob Halley <halley@dnspython.org>
Sun, 18 Jun 2023 15:24:29 +0000 (08:24 -0700)
tests/nanoquic.py

index 0bcb12c7682d1097e3af6a7cba51b881c8332b85..7599fcc6b1a3942f421e14298cb6b9c06bdbf5d9 100644 (file)
@@ -85,10 +85,12 @@ try:
             self.protocol = None
             self.left = None
             self.right = None
+            self.ready = threading.Event()
 
         def __enter__(self):
             self.left, self.right = socket.socketpair()
             self.start()
+            self.ready.wait(4)
 
         def __exit__(self, ex_ty, ex_va, ex_tr):
             if self.protocol is not None:
@@ -116,6 +118,7 @@ try:
                 ),
                 local_addr=("127.0.0.1", 8853),
             )
+            self.ready.set()
             try:
                 await reader.read(1)
             except Exception: