From a342353fd6c97c6ce2efa2d04f14f396ee90b18e Mon Sep 17 00:00:00 2001 From: Griatch Date: Mon, 1 Jan 2018 20:58:48 +0100 Subject: [PATCH] Add a slight delay to telnet handshake to give mudlet a chance to catch up --- evennia/commands/default/tests.py | 8 +++++--- evennia/server/sessionhandler.py | 8 +++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/evennia/commands/default/tests.py b/evennia/commands/default/tests.py index ffb63ef723..65fb0fa639 100644 --- a/evennia/commands/default/tests.py +++ b/evennia/commands/default/tests.py @@ -16,7 +16,7 @@ import re import types from django.conf import settings -from mock import Mock +from mock import Mock, mock from evennia.commands.default.cmdset_character import CharacterCmdSet from evennia.utils.test_resources import EvenniaTest @@ -37,12 +37,14 @@ _RE = re.compile(r"^\+|-+\+|\+-+|--*|\|(?:\s|$)", re.MULTILINE) # Command testing # ------------------------------------------------------------ + +@mock.patch("evennia.utils.utils.delay") class CommandTest(EvenniaTest): """ Tests a command """ - - def call(self, cmdobj, args, msg=None, cmdset=None, noansi=True, caller=None, receiver=None, cmdstring=None, obj=None): + def call(self, cmdobj, args, msg=None, cmdset=None, noansi=True, caller=None, + receiver=None, cmdstring=None, obj=None): """ Test a command by assigning all the needed properties to cmdobj and running diff --git a/evennia/server/sessionhandler.py b/evennia/server/sessionhandler.py index c8c0fafd64..5fb15930c9 100644 --- a/evennia/server/sessionhandler.py +++ b/evennia/server/sessionhandler.py @@ -310,7 +310,13 @@ class ServerSessionHandler(SessionHandler): sess.uid = None # show the first login command - self.data_in(sess, text=[[CMD_LOGINSTART], {}]) + + # this delay is necessary notably for Mudlet, which will fail on the connection screen + # unless the MXP protocol has been negotiated. Unfortunately this may be too short for some + # networks, the symptom is that < and > are not parsed by mudlet on first connection. + from evennia.utils.utils import delay + delay(0.3, self.data_in, sess, text=[[CMD_LOGINSTART], {}]) + # self.data_in(sess, text=[[CMD_LOGINSTART], {}]) def portal_session_sync(self, portalsessiondata): """