Resolves issue 130.
This commit is contained in:
parent
46ca685c76
commit
606ce0c3c5
1 changed files with 10 additions and 11 deletions
|
|
@ -110,20 +110,19 @@ class SessionHandler(object):
|
||||||
session.session_disconnect()
|
session.session_disconnect()
|
||||||
self.session_count(0)
|
self.session_count(0)
|
||||||
|
|
||||||
def disconnect_duplicate_sessions(self, session):
|
def disconnect_duplicate_sessions(self, curr_session):
|
||||||
"""
|
"""
|
||||||
Disconnects any existing sessions with the same game object. This is used in
|
Disconnects any existing sessions with the same game object.
|
||||||
connection recovery to help with record-keeping.
|
|
||||||
"""
|
"""
|
||||||
reason = "Your account has been logged in from elsewhere. Disconnecting."
|
reason = "Your account has been logged in from elsewhere. Disconnecting."
|
||||||
sessions = self.get_sessions()
|
curr_char = curr_session.get_character()
|
||||||
session_character = self.get_character(session)
|
doublet_sessions = [sess for sess in self.get_sessions()
|
||||||
|
if sess.get_character() == curr_char and sess != curr_session]
|
||||||
logged_out = 0
|
logged_out = 0
|
||||||
for other_session in sessions:
|
for session in doublet_sessions:
|
||||||
other_character = self.get_character(other_session)
|
session.msg(reason)
|
||||||
if session_character == other_character and other_session != session:
|
self.remove_session(session)
|
||||||
self.remove_session(other_session, reason=reason)
|
logged_out += 1
|
||||||
logged_out += 1
|
|
||||||
self.session_count(-logged_out)
|
self.session_count(-logged_out)
|
||||||
return logged_out
|
return logged_out
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue