From: Jeremy Stanley Date: Wed, 19 Mar 2014 19:05:57 +0000 (+0000) Subject: Fix log spamming on premature socket disconnect X-Git-Url: https://mudpy.org/gitweb?p=mudpy.git;a=commitdiff_plain;h=0b573f1662c8195b7f1ea6aec911d13d0c35841c Fix log spamming on premature socket disconnect * lib/mudpy/misc.py(User.flush): When sending on a user's socket raises BrokenPipeError, their connection has probably dropped. Go ahead and set their state to disconnecting so the socket will be cleaned up earily. This also stops spamming the log on every failed write to a broken socket before it eventually times out in the TCP/IP stack as well. --- diff --git a/lib/mudpy/misc.py b/lib/mudpy/misc.py index 42d14c8..ed48769 100644 --- a/lib/mudpy/misc.py +++ b/lib/mudpy/misc.py @@ -893,14 +893,13 @@ class User: try: self.connection.send(self.output_queue[0]) del self.output_queue[0] - except: + except BrokenPipeError: if self.account and self.account.get("name"): account = self.account.get("name") else: account = "an unknown user" - log("Sending to %s raised an exception (broken pipe?)." - % account, 7) - pass + log("Broken pipe sending to %s." % account, 7) + self.state = "disconnecting" def enqueue_input(self): """Process and enqueue any new input."""