From 27c12a5bf447fcbefb0ba5ed8fab432c919944a5 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 27 Jan 2016 21:23:22 +0100 Subject: [PATCH] protocols/logging,pc_rpc: do not print errors on Windows when clients disconnect --- artiq/protocols/logging.py | 3 +++ artiq/protocols/pc_rpc.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/artiq/protocols/logging.py b/artiq/protocols/logging.py index 693e58f7d..0c600e288 100644 --- a/artiq/protocols/logging.py +++ b/artiq/protocols/logging.py @@ -125,6 +125,9 @@ class Server(AsyncioServer): return source, remainder = linesplit parser.line_input(remainder) + except (ConnectionResetError, ConnectionAbortedError, BrokenPipeError): + # May happens on Windows when client disconnects + pass finally: writer.close() diff --git a/artiq/protocols/pc_rpc.py b/artiq/protocols/pc_rpc.py index 6d9feadb5..d1de343a9 100644 --- a/artiq/protocols/pc_rpc.py +++ b/artiq/protocols/pc_rpc.py @@ -502,6 +502,9 @@ class Server(_AsyncioServer): "message": traceback.format_exc()} line = pyon.encode(obj) + "\n" writer.write(line.encode()) + except (ConnectionResetError, ConnectionAbortedError, BrokenPipeError): + # May happens on Windows when client disconnects + pass finally: writer.close()