From ef49e23d88ab38660a664feac4e8c750a9993d78 Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Wed, 22 Nov 2017 23:09:10 +0000 Subject: [PATCH] Disconnect user on ConnectionResetError If sending to a user's socket results in a connection reset response, treat this as the same as a broken pipe and clean up the session. --- mudpy/misc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mudpy/misc.py b/mudpy/misc.py index a23b834..f325364 100644 --- a/mudpy/misc.py +++ b/mudpy/misc.py @@ -834,13 +834,13 @@ class User: if self.output_queue: try: self.connection.send(self.output_queue[0]) - except BrokenPipeError: + except (BrokenPipeError, ConnectionResetError): if self.account and self.account.get("name"): account = self.account.get("name") else: account = "an unknown user" self.state = "disconnecting" - log("Broken pipe sending to %s." % account, 7) + log("Disconnected while sending to %s." % account, 7) del self.output_queue[0] def enqueue_input(self): -- 2.11.0