Disconnect user on ConnectionResetError
authorJeremy Stanley <fungi@yuggoth.org>
Wed, 22 Nov 2017 23:09:10 +0000 (23:09 +0000)
committerJeremy Stanley <fungi@yuggoth.org>
Wed, 22 Nov 2017 23:09:10 +0000 (23:09 +0000)
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

index a23b834..f325364 100644 (file)
@@ -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):