disconnect clients if the max_clients setting is lowered
This commit is contained in:
parent
0a76801a03
commit
ad3ed1e626
@ -23,6 +23,7 @@ class ClientRegistry(object):
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.clients = []
|
self.clients = []
|
||||||
|
Config.get().wireProperty("max_clients", self._checkClientCount)
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
def broadcast(self):
|
def broadcast(self):
|
||||||
@ -46,3 +47,9 @@ class ClientRegistry(object):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
self.broadcast()
|
self.broadcast()
|
||||||
|
|
||||||
|
def _checkClientCount(self, new_count):
|
||||||
|
logger.debug("new client count: %i", new_count)
|
||||||
|
for client in self.clients[new_count:]:
|
||||||
|
logger.debug("closing one connection...")
|
||||||
|
client.close()
|
||||||
|
Loading…
Reference in New Issue
Block a user