Correct position of the except clause in listener loop
This commit is contained in:
parent
c4d22c4c21
commit
1b9648f3de
|
@ -28,6 +28,9 @@ class Listener(threading.Thread):
|
||||||
break
|
break
|
||||||
try:
|
try:
|
||||||
conn, addr = self.s.accept()
|
conn, addr = self.s.accept()
|
||||||
|
except socket.timeout:
|
||||||
|
continue
|
||||||
|
|
||||||
logging.info('Incoming connection from: %s:%i', *addr[:2])
|
logging.info('Incoming connection from: %s:%i', *addr[:2])
|
||||||
with shared.connections_lock:
|
with shared.connections_lock:
|
||||||
if len(shared.connections) > shared.connection_limit:
|
if len(shared.connections) > shared.connection_limit:
|
||||||
|
@ -36,5 +39,3 @@ class Listener(threading.Thread):
|
||||||
c = Connection(*addr[:2], conn, server=True)
|
c = Connection(*addr[:2], conn, server=True)
|
||||||
c.start()
|
c.start()
|
||||||
shared.connections.add(c)
|
shared.connections.add(c)
|
||||||
except socket.timeout:
|
|
||||||
pass
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user