diff --git a/session.py b/session.py index 51adcd8395..614078f904 100755 --- a/session.py +++ b/session.py @@ -21,11 +21,10 @@ class SessionProtocol(StatefulTelnetProtocol): """ What to do when we get a connection. """ - session_mgr.add_session(self) - self.game_connect_screen() self.prep_session() functions_general.log_infomsg('Connection: %s' % (self,)) - functions_general.log_infomsg('Sessions active: %d' % (len(session_mgr.get_session_list()),)) + session_mgr.add_session(self) + self.game_connect_screen() def getClientAddress(self): """ @@ -61,7 +60,7 @@ class SessionProtocol(StatefulTelnetProtocol): Execute this when a client abruplty loses their connection. """ functions_general.log_infomsg('Disconnect: %s' % (self,)) - functions_general.log_infomsg('Sessions active: %d' % (len(session_mgr.get_session_list()),)) + self.handle_close() def load_user_channels(self): """ @@ -96,7 +95,6 @@ class SessionProtocol(StatefulTelnetProtocol): self.disconnectClient() self.logged_in = False session_mgr.remove_session(self) - print 'Sessions active:', len(session_mgr.get_session_list()) def get_pobject(self): """ @@ -161,7 +159,7 @@ class SessionProtocol(StatefulTelnetProtocol): String representation of the user session class. We use this a lot in the server logs and stuff. """ - if self.logged_in: + if self.is_loggedin(): symbol = '#' else: symbol = '?' diff --git a/session_mgr.py b/session_mgr.py index 7571652c97..44967a217e 100644 --- a/session_mgr.py +++ b/session_mgr.py @@ -1,5 +1,6 @@ import time import gameconf +import functions_general """ Session manager, handles connected players. @@ -12,7 +13,7 @@ def add_session(session): Adds a session to the session list. """ session_list.insert(0, session) - print 'Sessions active:', len(get_session_list()) + functions_general.log_infomsg('Sessions active: %d' % (len(get_session_list(return_unlogged=True),))) def get_session_list(return_unlogged=False): """ @@ -42,7 +43,7 @@ def check_all_sessions(): if idle_timeout <= 0: return - for sess in get_session_list(): + for sess in get_session_list(return_unlogged=True): if (time.time() - sess.cmd_last) > idle_timeout: sess.msg("Idle timeout exceeded, disconnecting.") sess.handle_close() @@ -52,6 +53,7 @@ def remove_session(session): Removes a session from the session list. """ session_list.remove(session) + print 'Sessions active:', len(get_session_list()) def session_from_object(targobject): """