From 2bd6661ef4bfe9dffe7515f429cf8ccf53f38262 Mon Sep 17 00:00:00 2001 From: klonfish Date: Tue, 27 Dec 2016 00:33:13 +0100 Subject: [PATCH] Maybe better andling of connection reset error --- wii-pair/daemon.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wii-pair/daemon.py b/wii-pair/daemon.py index 44b9f7e..62cf0f6 100755 --- a/wii-pair/daemon.py +++ b/wii-pair/daemon.py @@ -173,7 +173,6 @@ try: conn, addr = s.accept() while True: - try: m = conn.recv(1) if len(m) == 0: @@ -193,9 +192,10 @@ try: v = int(round(w.pos_y*100)) r += struct.pack('b', v) - conn.send(r) - except ConnectionResetError: - continue + try: + conn.send(r) + except ConnectionResetError: + break except (KeyboardInterrupt, SystemExit): t1.stop = True t2.stop = True