mirror of
https://github.com/evennia/evennia.git
synced 2026-03-17 05:16:31 +01:00
Fixed a race condition when the telnet protocol synced with the server with a delay (such as when the connecting client didn't respond to all protocol request tokens. This could lead to the sync overwriting already updated session flags, notably the puppet id (puid). Resolves #583.
This commit is contained in:
parent
9f61f8e3bf
commit
36629a8bdb
3 changed files with 13 additions and 6 deletions
|
|
@ -64,6 +64,14 @@ class PortalSessionHandler(SessionHandler):
|
|||
# only use if session already has sessid (i.e. has already connected)
|
||||
sessdata = session.get_sync_data()
|
||||
if self.portal.amp_protocol:
|
||||
# we remove sessdata that could already have changed on the
|
||||
# server level
|
||||
sessdata = dict((key, val) for key, val in sessdata.items() if key in ("protocol_key",
|
||||
"address",
|
||||
"suid",
|
||||
"conn_time",
|
||||
"protocol_flags",
|
||||
"server_data",))
|
||||
self.portal.amp_protocol.call_remote_ServerAdmin(session.sessid,
|
||||
operation=PCONNSYNC,
|
||||
data=sessdata)
|
||||
|
|
|
|||
|
|
@ -234,12 +234,6 @@ class ServerSession(Session):
|
|||
Send Evennia -> User
|
||||
"""
|
||||
text = text if text else ""
|
||||
#if text is None:
|
||||
# text = ""
|
||||
#else:
|
||||
# text = to_unicode(text)
|
||||
# text = to_str(text, self.encoding)
|
||||
|
||||
self.sessionhandler.data_out(self, text=text, **kwargs)
|
||||
|
||||
def __eq__(self, other):
|
||||
|
|
|
|||
|
|
@ -220,6 +220,11 @@ class ServerSessionHandler(SessionHandler):
|
|||
sessid = portalsessiondata.get("sessid")
|
||||
session = self.sessions.get(sessid)
|
||||
if session:
|
||||
# since some of the session properties may have had
|
||||
# a chance to change already before the portal gets here
|
||||
# the portal doesn't send all sessiondata here, but only
|
||||
# ones which should only be changed from portal (like
|
||||
# protocol_flags etc)
|
||||
session.load_sync_data(portalsessiondata)
|
||||
|
||||
def portal_disconnect(self, sessid):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue