Updated how the automatic timeout closes the session on the portal side. A lot cleaner now.
This commit is contained in:
parent
895f8504cd
commit
000f14c028
4 changed files with 4 additions and 17 deletions
|
|
@ -196,12 +196,11 @@ CMDLINE_HELP = \
|
||||||
|
|
||||||
VERSION_INFO = \
|
VERSION_INFO = \
|
||||||
"""
|
"""
|
||||||
{about}
|
|
||||||
Evennia {version}
|
Evennia {version}
|
||||||
OS: {os}
|
OS: {os}
|
||||||
Python: {python}
|
Python: {python}
|
||||||
Twisted: {twisted}
|
Twisted: {twisted}
|
||||||
Django: {django}
|
Django: {django}{about}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
ABOUT_INFO= \
|
ABOUT_INFO= \
|
||||||
|
|
|
||||||
|
|
@ -122,14 +122,9 @@ class PortalSessionHandler(SessionHandler):
|
||||||
from the portal side.
|
from the portal side.
|
||||||
"""
|
"""
|
||||||
sessid = session.sessid
|
sessid = session.sessid
|
||||||
if sessid in self.sessions:
|
|
||||||
del self.sessions[sessid]
|
|
||||||
del session
|
|
||||||
# tell server to also delete this session
|
|
||||||
self.portal.amp_protocol.call_remote_ServerAdmin(sessid,
|
self.portal.amp_protocol.call_remote_ServerAdmin(sessid,
|
||||||
operation=PDISCONN)
|
operation=PDISCONN)
|
||||||
|
|
||||||
|
|
||||||
def server_connect(self, protocol_path="", config=dict()):
|
def server_connect(self, protocol_path="", config=dict()):
|
||||||
"""
|
"""
|
||||||
Called by server to force the initialization of a new
|
Called by server to force the initialization of a new
|
||||||
|
|
|
||||||
|
|
@ -65,8 +65,8 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
|
||||||
delay(2, callback=self.handshake_done, retval=True)
|
delay(2, callback=self.handshake_done, retval=True)
|
||||||
|
|
||||||
# set up a keep-alive
|
# set up a keep-alive
|
||||||
self.keep_alive = LoopingCall(self._write, IAC + NOP, now=False)
|
self.keep_alive = LoopingCall(self._write, IAC + NOP)
|
||||||
self.keep_alive.start(30)
|
self.keep_alive.start(30, now=False)
|
||||||
|
|
||||||
|
|
||||||
def handshake_done(self, force=False):
|
def handshake_done(self, force=False):
|
||||||
|
|
|
||||||
|
|
@ -185,14 +185,7 @@ class ServerSessionHandler(SessionHandler):
|
||||||
session = self.sessions.get(sessid, None)
|
session = self.sessions.get(sessid, None)
|
||||||
if not session:
|
if not session:
|
||||||
return
|
return
|
||||||
player = session.player
|
self.disconnect(session)
|
||||||
if player:
|
|
||||||
nsess = len(self.sessions_from_player(player)) - 1
|
|
||||||
remaintext = nsess and "%i session%s remaining" % (nsess, nsess > 1 and "s" or "") or "no more sessions"
|
|
||||||
session.log(_('Connection dropped: %s %s (%s)' % (session.player, session.address, remaintext)))
|
|
||||||
session.at_disconnect()
|
|
||||||
session.disconnect()
|
|
||||||
del self.sessions[session.sessid]
|
|
||||||
|
|
||||||
def portal_sessions_sync(self, portalsessions):
|
def portal_sessions_sync(self, portalsessions):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue