Cleaning up the duplicate session disconnector.

This commit is contained in:
Greg Taylor 2009-01-22 00:17:43 +00:00
parent 1045d0fabf
commit 8909b9d2c0

View file

@ -38,16 +38,16 @@ def disconnect_duplicate_session(session):
Disconnects any existing session under the same object. This is used in Disconnects any existing session under the same object. This is used in
connection recovery to help with record-keeping. connection recovery to help with record-keeping.
""" """
sess_list = get_session_list() session_list = get_session_list()
new_pobj = session.get_pobject() session_pobj = session.get_pobject()
for sess in sess_list: for other_session in session_list:
if new_pobj == sess.get_pobject() and sess != session: other_pobject = other_session.get_pobject()
sess.msg("Your account has been logged in from elsewhere, disconnecting.") if session_pobj == other_pobject and other_session != session:
sess.disconnectClient() other_session.msg("Your account has been logged in from elsewhere, disconnecting.")
other_session.disconnectClient()
return True return True
return False return False
def check_all_sessions(): def check_all_sessions():
""" """
Check all currently connected sessions and see if any are dead. Check all currently connected sessions and see if any are dead.