Fixed a bug which caused a failure when logging out
This commit is contained in:
parent
fbe3144d75
commit
83e24678f5
6 changed files with 12 additions and 11 deletions
|
|
@ -86,7 +86,7 @@ def _portal_maintenance():
|
|||
reason = "Idle timeout exceeded, disconnecting."
|
||||
for session in [sess for sess in PORTAL_SESSIONS.values()
|
||||
if (now - sess.cmd_last) > _IDLE_TIMEOUT]:
|
||||
session.data_out(reason)
|
||||
session.data_out(text=reason)
|
||||
PORTAL_SESSIONS.disconnect(session)
|
||||
|
||||
if _IDLE_TIMEOUT > 0:
|
||||
|
|
|
|||
|
|
@ -88,9 +88,9 @@ class PortalSessionHandler(SessionHandler):
|
|||
session.server_connected = False
|
||||
_CONNECTION_QUEUE.appendleft(session)
|
||||
if len(_CONNECTION_QUEUE) > 1:
|
||||
session.data_out("%s DoS protection is active. You are queued to connect in %g seconds ..." % (
|
||||
session.data_out(text=[["%s DoS protection is active. You are queued to connect in %g seconds ..." % (
|
||||
settings.SERVERNAME,
|
||||
len(_CONNECTION_QUEUE)*_MIN_TIME_BETWEEN_CONNECTS))
|
||||
len(_CONNECTION_QUEUE)*_MIN_TIME_BETWEEN_CONNECTS)],{}])
|
||||
now = time()
|
||||
if (now - self.connection_last < _MIN_TIME_BETWEEN_CONNECTS) or not self.portal.amp_protocol:
|
||||
if not session or not self.connection_task:
|
||||
|
|
@ -331,7 +331,7 @@ class PortalSessionHandler(SessionHandler):
|
|||
if self.command_overflow:
|
||||
reactor.callLater(1.0, self.data_in, None)
|
||||
if self.command_overflow:
|
||||
self.data_out(session, text=_ERROR_COMMAND_OVERFLOW)
|
||||
self.data_out(session, text=[[_ERROR_COMMAND_OVERFLOW],{}])
|
||||
return
|
||||
# scrub data
|
||||
kwargs = self.clean_senddata(session, kwargs)
|
||||
|
|
@ -359,7 +359,7 @@ class PortalSessionHandler(SessionHandler):
|
|||
kwargs (any): Each key is a command instruction to the
|
||||
protocol on the form key = [[args],{kwargs}]. This will
|
||||
call a method send_<key> on the protocol. If no such
|
||||
method exixts, it send the data to a method send_default.
|
||||
method exixts, it sends the data to a method send_default.
|
||||
|
||||
"""
|
||||
#from evennia.server.profiling.timetrace import timetrace
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
|
|||
|
||||
"""
|
||||
if reason:
|
||||
self.data_out(reason)
|
||||
self.data_out(text=[[reason], {}])
|
||||
self.connectionLost(reason)
|
||||
|
||||
def data_in(self, **kwargs):
|
||||
|
|
@ -355,5 +355,4 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
|
|||
Send other oob data
|
||||
"""
|
||||
if not cmdname == "options":
|
||||
print "telnet.send_default:", cmdname, args, kwargs
|
||||
self.oob.data_out(cmdname, *args, **kwargs)
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ class WebSocketClient(Protocol, Session):
|
|||
|
||||
"""
|
||||
if reason:
|
||||
self.data_out(text=reason)
|
||||
self.data_out(text=[[reason],{}])
|
||||
self.connectionLost(reason)
|
||||
|
||||
def connectionLost(self, reason):
|
||||
|
|
|
|||
|
|
@ -332,7 +332,7 @@ class ServerSession(Session):
|
|||
|
||||
def data_out(self, **kwargs):
|
||||
"""
|
||||
Sending data from Evennia->Player
|
||||
Sending data from Evennia->Client
|
||||
|
||||
Kwargs:
|
||||
text (str or tuple)
|
||||
|
|
@ -345,7 +345,9 @@ class ServerSession(Session):
|
|||
|
||||
def msg(self, text=None, **kwargs):
|
||||
"""
|
||||
Wrapper to mimic msg() functionality elsewhere.
|
||||
Wrapper to mimic msg() functionality of Objects and Players
|
||||
(server sessions don't use data_in since incoming data is
|
||||
handled by inputfuncs).
|
||||
|
||||
Args:
|
||||
text (str): String input.
|
||||
|
|
|
|||
|
|
@ -587,7 +587,7 @@ class ServerSessionHandler(SessionHandler):
|
|||
|
||||
"""
|
||||
for sess in self.values():
|
||||
self.data_out(sess, message)
|
||||
self.data_out(sess, text=message)
|
||||
|
||||
def data_out(self, session, **kwargs):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue