Skip to content

Commit

Permalink
#582: run clean_quit() from an idle_add callback rather than the sign…
Browse files Browse the repository at this point in the history
…al handler directly

git-svn-id: https://xpra.org/svn/Xpra/trunk@9194 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Apr 29, 2015
1 parent ba0e04f commit 912729f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/xpra/server/server_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ def is_child_alive(self, proc):
def reaper_exit(self):
if self.exit_with_children:
log.info("all children have exited and --exit-with-children was specified, exiting")
self.idle_add(self.clean_quit, False)
self.idle_add(self.clean_quit)


def cleanup(self, *args):
Expand All @@ -589,7 +589,7 @@ def _disconnect_all(self, message, *extra):
def _process_exit_server(self, proto, packet):
log.info("Exiting response to request")
self._disconnect_all(SERVER_EXIT)
self.timeout_add(1000, self.clean_quit, False, ServerCore.EXITING_CODE)
self.timeout_add(1000, self.clean_quit, ServerCore.EXITING_CODE)

def _process_shutdown_server(self, proto, packet):
log.info("Shutting down in response to request")
Expand Down
15 changes: 7 additions & 8 deletions src/xpra/server/server_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,17 +259,17 @@ def do_init_aliases(self, packet_types):


def reaper_quit(self):
self.clean_quit(False)
self.clean_quit()

def signal_quit(self, signum, frame):
log.info("")
log.info("got signal %s, exiting", SIGNAMES.get(signum, signum))
signal.signal(signal.SIGINT, deadly_signal)
signal.signal(signal.SIGTERM, deadly_signal)
self.clean_quit(True)
self.idle_add(self.clean_quit)

def clean_quit(self, from_signal=False, upgrading=False):
log("clean_quit(%s, %s)", from_signal, upgrading)
def clean_quit(self, upgrading=False):
log("clean_quit(%s)", upgrading)
#ensure the reaper doesn't call us again:
if self.child_reaper:
def noop():
Expand All @@ -281,10 +281,9 @@ def quit_timer(*args):
log.debug("quit_timer()")
self.quit(upgrading)
#if from a signal, just force quit:
stop_worker(from_signal)
if not from_signal:
#not from signal: use force stop worker after delay
self.timeout_add(250, stop_worker, True)
stop_worker()
#not from signal: use force stop worker after delay
self.timeout_add(250, stop_worker, True)
self.timeout_add(500, quit_timer)
def force_quit(*args):
log.debug("force_quit()")
Expand Down

0 comments on commit 912729f

Please sign in to comment.