Skip to content

Commit

Permalink
#669: fix signal exit on osx, close the protocol early
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@8986 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Apr 10, 2015
1 parent 38aa1c6 commit e3721b8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/xpra/net/subprocess_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@ def cleanup(self):
self.stop()

def stop(self):
self.stop_process()
self.stop_protocol()

def stop_process(self):
log("stop() sending stop request to %s", self.description)
proc = self.process
if proc and proc.poll() is None:
Expand All @@ -307,6 +311,8 @@ def stop(self):
self.process = None
except Exception as e:
log.warn("failed to stop the wrapped subprocess %s: %s", proc, e)

def stop_protocol(self):
p = self.protocol
if p:
self.protocol = None
Expand Down
10 changes: 8 additions & 2 deletions src/xpra/sound/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ def __init__(self, description):
#hook some default packet handlers:
self.connect("state-changed", self.state_changed)
self.connect("info", self.info_update)
self.connect("signal", self.subprocess_signal)


def cleanup(self):
Expand All @@ -159,7 +160,12 @@ def cleanup(self):
gobject.timeout_add(500, self.stop)


def state_changed(self, sink, new_state):
def subprocess_signal(self, wrapper, proc):
log("subprocess_signal: %s", proc)
self.stop_protocol()


def state_changed(self, wrapper, new_state):
self.state = new_state

def get_state(self):
Expand All @@ -169,7 +175,7 @@ def get_state(self):
def get_info(self):
return self.last_info

def info_update(self, sink, info):
def info_update(self, wrapper, info):
log("info_update: %s", info)
self.last_info = info
self.last_info["time"] = int(time.time())
Expand Down

0 comments on commit e3721b8

Please sign in to comment.