Skip to content

Commit

Permalink
Merge 42f7f49 into ffb9bef
Browse files Browse the repository at this point in the history
  • Loading branch information
TehomCD committed Nov 24, 2016
2 parents ffb9bef + 42f7f49 commit 26208eb
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 20 deletions.
8 changes: 6 additions & 2 deletions evennia/server/evennia_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -732,8 +732,12 @@ def kill(pidfile, signal=SIG, succmsg="", errmsg="",
"The PID file 'server/%(pidfile)s' seems stale. "\
"Try removing it." % {'pid': pid, 'pidfile': pidfile})
return
print("Evennia:", succmsg)
return
try:
print("Evennia:", succmsg)
return
except KeyboardInterrupt:
print("Evennia:", succmsg)
return
print("Evennia:", errmsg)


Expand Down
40 changes: 22 additions & 18 deletions evennia/server/evennia_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,26 +185,30 @@ def portal_waiter(queue):
while True:

# this blocks until something is actually returned.
from twisted.internet.error import ReactorNotRunning
try:
message, rc = processes.get()
except KeyboardInterrupt:
# this only matters in interactive mode
try:
message, rc = processes.get()
except KeyboardInterrupt:
# this only matters in interactive mode
break

# restart only if process stopped cleanly
if (message == "server_stopped" and int(rc) == 0 and
get_restart_mode(SERVER_RESTART) in ("True", "reload", "reset")):
print(PROCESS_RESTART.format(component="Server"))
SERVER = thread.start_new_thread(server_waiter, (processes, ))
continue

# normally the portal is not reloaded since it's run as a daemon.
if (message == "portal_stopped" and int(rc) == 0 and
get_restart_mode(PORTAL_RESTART) == "True"):
print(PROCESS_RESTART.format(component="Portal"))
PORTAL = thread.start_new_thread(portal_waiter, (processes, ))
continue
break
except ReactorNotRunning:
break

# restart only if process stopped cleanly
if (message == "server_stopped" and int(rc) == 0 and
get_restart_mode(SERVER_RESTART) in ("True", "reload", "reset")):
print(PROCESS_RESTART.format(component="Server"))
SERVER = thread.start_new_thread(server_waiter, (processes, ))
continue

# normally the portal is not reloaded since it's run as a daemon.
if (message == "portal_stopped" and int(rc) == 0 and
get_restart_mode(PORTAL_RESTART) == "True"):
print(PROCESS_RESTART.format(component="Portal"))
PORTAL = thread.start_new_thread(portal_waiter, (processes, ))
continue
break


def main():
Expand Down

0 comments on commit 26208eb

Please sign in to comment.