Getting a little further in the process

This commit is contained in:
Griatch 2018-10-13 18:50:37 +02:00
parent de09153d15
commit 69932c369e
3 changed files with 18 additions and 4 deletions

View file

@ -950,6 +950,15 @@ def reboot_evennia(pprofiler=False, sprofiler=False):
send_instruction(PSTATUS, None, _portal_running, _portal_not_running)
def start_only_server():
"""
Tell portal to start server (debug)
"""
portal_cmd, server_cmd = _get_twistd_cmdline(False, False)
print("launcher: Sending to portal: SSTART + {}".format(server_cmd))
send_instruction(SSTART, server_cmd)
def start_server_interactive():
"""
Start the Server under control of the launcher process (foreground)
@ -2012,7 +2021,7 @@ def main():
init_game_directory(CURRENT_DIR, check_db=True)
run_menu()
elif option in ('status', 'info', 'start', 'istart', 'ipstart', 'reload', 'restart', 'reboot',
'reset', 'stop', 'sstop', 'kill', 'skill'):
'reset', 'stop', 'sstop', 'kill', 'skill', 'sstart'):
# operate the server directly
if not SERVER_LOGFILE:
init_game_directory(CURRENT_DIR, check_db=True)
@ -2036,6 +2045,8 @@ def main():
stop_evennia()
elif option == 'sstop':
stop_server_only()
elif option == 'sstart':
start_only_server()
elif option == 'kill':
if _is_windows():
print("This option is not supported on Windows.")

View file

@ -146,7 +146,7 @@ class Compressed(amp.String):
def toString(self, inObject):
"""
Convert to send as a string on the wire, with compression.
Convert to send as a bytestring on the wire, with compression.
Note: In Py3 this is really a byte stream.
@ -368,7 +368,6 @@ class AMPMultiConnectionProtocol(amp.AMP):
"""
msg = loads(packed_data)
print("amp.data_in: {}".format(msg))
return msg
def broadcast(self, command, sessid, **kwargs):

View file

@ -301,12 +301,15 @@ class AMPServerProtocol(amp.AMPMultiConnectionProtocol):
launcher. It can obviously only accessed when the Portal is already up and running.
"""
# Since the launcher command uses amp.String() we need to convert from byte here.
operation = str(operation, 'utf-8')
self.factory.launcher_connection = self
_, server_connected, _, _, _, _ = self.get_status()
logger.log_msg("Evennia Launcher->Portal operation %s:%s received" % (ord(operation), arguments))
logger.log_msg("operation == amp.SSTART: {}: {}".format(operation == amp.SSTART, amp.loads(arguments)))
if operation == amp.SSTART: # portal start #15
# first, check if server is already running
if not server_connected:
@ -346,6 +349,7 @@ class AMPServerProtocol(amp.AMPMultiConnectionProtocol):
self.factory.portal.shutdown()
else:
logger.log_msg("Operation {} not recognized".format(operation))
raise Exception("operation %(op)s not recognized." % {'op': operation})
return {}