count_client(): use client with a filled username

This commit is contained in:
Fred Z 2018-03-09 00:01:54 +01:00
parent ddf9d57d38
commit 2f024b5d0a
1 changed files with 9 additions and 2 deletions

View File

@ -109,8 +109,15 @@ class ConnectSocket:
print(self._MSG_SERVER_STOP)
def count_clients(self):
""" Count connected clients"""
return len(self._inputs) - 1
"""
Count connected and named clients
(to avoid playing with a unamed player)
"""
connect = 1 # the 1st entry is the main connection
unnamed = self._user_name.count(False) # unnamed clients
total = len(self._user_name) # All sockets
return total - unnamed - connect
def list_sockets(self, print_it=True):
""" List connected sckts """