From 11b09df714b9d159a47cc9fe9e3934ac32646f9a Mon Sep 17 00:00:00 2001 From: Bob Halley Date: Thu, 7 Mar 2024 05:15:34 -0800 Subject: [PATCH] Close QUIC sync and trio sockets when done. --- dns/quic/_sync.py | 1 + dns/quic/_trio.py | 1 + 2 files changed, 2 insertions(+) diff --git a/dns/quic/_sync.py b/dns/quic/_sync.py index 78f6c5e2..473d1f48 100644 --- a/dns/quic/_sync.py +++ b/dns/quic/_sync.py @@ -153,6 +153,7 @@ def _worker(self): finally: with self._lock: self._done = True + self._socket.close() # Ensure anyone waiting for this gets woken up. self._handshake_complete.set() diff --git a/dns/quic/_trio.py b/dns/quic/_trio.py index bf284557..ae79f369 100644 --- a/dns/quic/_trio.py +++ b/dns/quic/_trio.py @@ -126,6 +126,7 @@ async def _worker(self): await self._socket.send(datagram) finally: self._done = True + self._socket.close() self._handshake_complete.set() async def _handle_events(self):