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.
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."""