From d8917a25f912911288217da7b601ff6330c8fcdb Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Tue, 23 Feb 2016 22:32:27 +0000 Subject: [PATCH] Fix recursive BrokenPipeException on disconnect When an admin user has a broken pipe, attempting to log BrokenPipeException errors to their socket raises another until the max recursion depth is hit. Set the current user's state to disconnecting before logging the error instead of after, so as to avoid this loop. --- lib/mudpy/misc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/mudpy/misc.py b/lib/mudpy/misc.py index ea18ffb..41d3ab6 100644 --- a/lib/mudpy/misc.py +++ b/lib/mudpy/misc.py @@ -840,14 +840,14 @@ class User: if self.output_queue: try: self.connection.send(self.output_queue[0]) - del self.output_queue[0] except BrokenPipeError: if self.account and self.account.get("name"): account = self.account.get("name") else: account = "an unknown user" - log("Broken pipe sending to %s." % account, 7) self.state = "disconnecting" + log("Broken pipe sending to %s." % account, 7) + del self.output_queue[0] def enqueue_input(self): """Process and enqueue any new input.""" -- 2.11.0