From 835a5824f9313c9154388e0074bcfcb8b2a97a2e Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Thu, 27 Mar 2014 10:51:17 +0000 Subject: [PATCH] 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. --- 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 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 -- 2.11.0