From: Jeremy Stanley Date: Tue, 23 Feb 2016 22:32:27 +0000 (+0000) Subject: Fix recursive BrokenPipeException on disconnect X-Git-Tag: 0.0.1~196 X-Git-Url: https://mudpy.org/gitweb?a=commitdiff_plain;h=d8917a25f912911288217da7b601ff6330c8fcdb;p=mudpy.git 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. --- 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."""