From: Jeremy Stanley Date: Wed, 22 Nov 2017 23:09:10 +0000 (+0000) Subject: Disconnect user on ConnectionResetError X-Git-Tag: 0.0.1~114 X-Git-Url: https://mudpy.org/gitweb?a=commitdiff_plain;h=ef49e23d88ab38660a664feac4e8c750a9993d78;p=mudpy.git 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. --- 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):