Fix no-location issues for istart (resolves #1662).

This commit is contained in:
Griatch 2018-09-23 23:29:23 +02:00
parent 3537ae13a4
commit 0d3c9ebea3
2 changed files with 11 additions and 5 deletions

View file

@ -971,16 +971,17 @@ def start_server_interactive():
print("... Stopped Server with Ctrl-C.") print("... Stopped Server with Ctrl-C.")
else: else:
print("... Server stopped (leaving interactive mode).") print("... Server stopped (leaving interactive mode).")
stop_server_only(when_stopped=_iserver) stop_server_only(when_stopped=_iserver, interactive=True)
def stop_server_only(when_stopped=None): def stop_server_only(when_stopped=None, interactive=False):
""" """
Only stop the Server-component of Evennia (this is not useful except for debug) Only stop the Server-component of Evennia (this is not useful except for debug)
Args: Args:
when_stopped (callable): This will be called with no arguments when Server has stopped (or when_stopped (callable): This will be called with no arguments when Server has stopped (or
if it had already stopped when this is called). if it had already stopped when this is called).
interactive (bool, optional): Set if this is called as part of the interactive reload mechanism.
""" """
def _server_stopped(*args): def _server_stopped(*args):
@ -995,7 +996,10 @@ def stop_server_only(when_stopped=None):
if srun: if srun:
print("Server stopping ...") print("Server stopping ...")
wait_for_status_reply(_server_stopped) wait_for_status_reply(_server_stopped)
send_instruction(SSHUTD, {}) if interactive:
send_instruction(SRELOAD, {})
else:
send_instruction(SSHUTD, {})
else: else:
if when_stopped: if when_stopped:
when_stopped() when_stopped()
@ -1005,6 +1009,8 @@ def stop_server_only(when_stopped=None):
def _portal_not_running(fail): def _portal_not_running(fail):
print("Evennia is not running.") print("Evennia is not running.")
if interactive:
print("Start Evennia normally first, then use `istart` to switch to interactive mode.")
_reactor_stop() _reactor_stop()
send_instruction(PSTATUS, None, _portal_running, _portal_not_running) send_instruction(PSTATUS, None, _portal_running, _portal_not_running)

View file

@ -192,9 +192,9 @@ class Evennia(object):
from twisted.internet.defer import Deferred from twisted.internet.defer import Deferred
if hasattr(self, "web_root"): if hasattr(self, "web_root"):
d = self.web_root.empty_threadpool() d = self.web_root.empty_threadpool()
d.addCallback(lambda _: self.shutdown("shutdown", _reactor_stopping=True)) d.addCallback(lambda _: self.shutdown("reload", _reactor_stopping=True))
else: else:
d = Deferred(lambda _: self.shutdown("shutdown", _reactor_stopping=True)) d = Deferred(lambda _: self.shutdown("reload", _reactor_stopping=True))
d.addCallback(lambda _: reactor.stop()) d.addCallback(lambda _: reactor.stop())
reactor.callLater(1, d.callback, None) reactor.callLater(1, d.callback, None)
reactor.sigInt = _wrap_sigint_handler reactor.sigInt = _wrap_sigint_handler