From f49f8d2580eabfa75b72eadad8b4bda7075c257f Mon Sep 17 00:00:00 2001
From: 3manifold <22544721+3manifold@users.noreply.github.com>
Date: Thu, 10 Oct 2024 13:26:08 +0200
Subject: [PATCH] Fix hanging client on KeyboardInterrupt

---
 listen_and_play.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/listen_and_play.py b/listen_and_play.py
index 35eabd6..701fe04 100644
--- a/listen_and_play.py
+++ b/listen_and_play.py
@@ -113,6 +113,8 @@ def listen_and_play(
 
     finally:
         stop_event.set()
+        # Given that socket::recv is blocking in receive_data_chunk, shut it down to allow the thread to continue.
+        recv_socket.shutdown(socket.SHUT_RDWR)
         recv_thread.join()
         send_thread.join()
         send_socket.close()
-- 
GitLab