Getting a little further in the process
This commit is contained in:
parent
54e351f296
commit
1e332d6f3b
3 changed files with 18 additions and 4 deletions
|
|
@ -950,6 +950,15 @@ def reboot_evennia(pprofiler=False, sprofiler=False):
|
||||||
send_instruction(PSTATUS, None, _portal_running, _portal_not_running)
|
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():
|
def start_server_interactive():
|
||||||
"""
|
"""
|
||||||
Start the Server under control of the launcher process (foreground)
|
Start the Server under control of the launcher process (foreground)
|
||||||
|
|
@ -2012,7 +2021,7 @@ def main():
|
||||||
init_game_directory(CURRENT_DIR, check_db=True)
|
init_game_directory(CURRENT_DIR, check_db=True)
|
||||||
run_menu()
|
run_menu()
|
||||||
elif option in ('status', 'info', 'start', 'istart', 'ipstart', 'reload', 'restart', 'reboot',
|
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
|
# operate the server directly
|
||||||
if not SERVER_LOGFILE:
|
if not SERVER_LOGFILE:
|
||||||
init_game_directory(CURRENT_DIR, check_db=True)
|
init_game_directory(CURRENT_DIR, check_db=True)
|
||||||
|
|
@ -2036,6 +2045,8 @@ def main():
|
||||||
stop_evennia()
|
stop_evennia()
|
||||||
elif option == 'sstop':
|
elif option == 'sstop':
|
||||||
stop_server_only()
|
stop_server_only()
|
||||||
|
elif option == 'sstart':
|
||||||
|
start_only_server()
|
||||||
elif option == 'kill':
|
elif option == 'kill':
|
||||||
if _is_windows():
|
if _is_windows():
|
||||||
print("This option is not supported on Windows.")
|
print("This option is not supported on Windows.")
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ class Compressed(amp.String):
|
||||||
|
|
||||||
def toString(self, inObject):
|
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.
|
Note: In Py3 this is really a byte stream.
|
||||||
|
|
||||||
|
|
@ -368,7 +368,6 @@ class AMPMultiConnectionProtocol(amp.AMP):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
msg = loads(packed_data)
|
msg = loads(packed_data)
|
||||||
print("amp.data_in: {}".format(msg))
|
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
def broadcast(self, command, sessid, **kwargs):
|
def broadcast(self, command, sessid, **kwargs):
|
||||||
|
|
|
||||||
|
|
@ -301,12 +301,15 @@ class AMPServerProtocol(amp.AMPMultiConnectionProtocol):
|
||||||
launcher. It can obviously only accessed when the Portal is already up and running.
|
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
|
self.factory.launcher_connection = self
|
||||||
|
|
||||||
_, server_connected, _, _, _, _ = self.get_status()
|
_, server_connected, _, _, _, _ = self.get_status()
|
||||||
|
|
||||||
logger.log_msg("Evennia Launcher->Portal operation %s:%s received" % (ord(operation), arguments))
|
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
|
if operation == amp.SSTART: # portal start #15
|
||||||
# first, check if server is already running
|
# first, check if server is already running
|
||||||
if not server_connected:
|
if not server_connected:
|
||||||
|
|
@ -346,6 +349,7 @@ class AMPServerProtocol(amp.AMPMultiConnectionProtocol):
|
||||||
self.factory.portal.shutdown()
|
self.factory.portal.shutdown()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
logger.log_msg("Operation {} not recognized".format(operation))
|
||||||
raise Exception("operation %(op)s not recognized." % {'op': operation})
|
raise Exception("operation %(op)s not recognized." % {'op': operation})
|
||||||
|
|
||||||
return {}
|
return {}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue