From 110dfc33245307bc61fd7eff8ef2cc129931b84f Mon Sep 17 00:00:00 2001 From: Lee Miller Date: Fri, 1 Sep 2023 06:03:45 +0300 Subject: [PATCH] Correct position of the except clause in listener loop --- minode/listener.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/minode/listener.py b/minode/listener.py index 88b26db..bec5365 100644 --- a/minode/listener.py +++ b/minode/listener.py @@ -28,13 +28,14 @@ class Listener(threading.Thread): break try: conn, addr = self.s.accept() - logging.info('Incoming connection from: %s:%i', *addr[:2]) - with shared.connections_lock: - if len(shared.connections) > shared.connection_limit: - conn.close() - else: - c = Connection(*addr[:2], conn, server=True) - c.start() - shared.connections.add(c) except socket.timeout: - pass + continue + + logging.info('Incoming connection from: %s:%i', *addr[:2]) + with shared.connections_lock: + if len(shared.connections) > shared.connection_limit: + conn.close() + else: + c = Connection(*addr[:2], conn, server=True) + c.start() + shared.connections.add(c)