From: Jeremy Stanley Date: Thu, 27 Mar 2014 10:51:17 +0000 (+0000) Subject: Tighten exceptions for new sockets and reads X-Git-Tag: 0.0.1~250 X-Git-Url: https://mudpy.org/gitweb?p=mudpy.git;a=commitdiff_plain;h=835a5824f9313c9154388e0074bcfcb8b2a97a2e Tighten exceptions for new sockets and reads * lib/mudpy/misc.py(User.enqueue_input,check_for_connection): When reading from a socket or polling for a new connection, be specific about the exceptions which are benign so that we will still error out when more detrimental exceptions are raised. --- diff --git a/lib/mudpy/misc.py b/lib/mudpy/misc.py index ed48769..7e8e612 100644 --- a/lib/mudpy/misc.py +++ b/lib/mudpy/misc.py @@ -907,7 +907,7 @@ class User: # check for some input try: raw_input = self.connection.recv(1024) - except: + except (BlockingIOError, OSError): raw_input = b"" # we got something @@ -1489,7 +1489,7 @@ def check_for_connection(listening_socket): # try to accept a new connection try: connection, address = listening_socket.accept() - except: + except BlockingIOError: return None # note that we got one