[X2Go-Commits] python-x2go.git - brokerclient (branch) updated: 0.1.1.4-155-gfdfd1f3
X2Go dev team
git-admin at x2go.org
Tue Jan 7 16:21:04 CET 2014
The branch, brokerclient has been updated
via fdfd1f388eaee05a77ef928664ba2f7c6c2b8bb1 (commit)
from 451748c73bc038c127e89e05e8bb30d5814416aa (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
x2go/__init__.py | 5 -----
x2go/cleanup.py | 10 ++++++++--
x2go/guardian.py | 10 +---------
x2go/xserver.py | 18 ++++++++++++++----
4 files changed, 23 insertions(+), 20 deletions(-)
The diff of changes is:
diff --git a/x2go/__init__.py b/x2go/__init__.py
index d6f1fc3..cd60a0a 100644
--- a/x2go/__init__.py
+++ b/x2go/__init__.py
@@ -165,11 +165,6 @@ monkey.patch_all()
import utils
-import guardian
-import signal as _signal
-_signal.signal (_signal.SIGTERM, guardian._sigterm_handle )
-_signal.signal (_signal.SIGINT, guardian._sigterm_handle )
-
from client import X2goClient
from backends.profiles import X2goSessionProfiles
from backends.printing import X2goClientPrinting
diff --git a/x2go/cleanup.py b/x2go/cleanup.py
index 82d49d1..bc4f667 100644
--- a/x2go/cleanup.py
+++ b/x2go/cleanup.py
@@ -27,6 +27,7 @@ import paramiko
import threading
# Python X2Go modules
+import guardian
import rforward
from defaults import X2GOCLIENT_OS as _X2GOCLIENT_OS
@@ -85,7 +86,6 @@ def x2go_cleanup(e=None, threads=None):
for t in threads:
if type(t) == xserver.X2goXServer:
t.stop_thread()
- gevent.sleep(1)
del t
# on Windows: stop the PulseAudio daemon that we evoked
@@ -93,9 +93,15 @@ def x2go_cleanup(e=None, threads=None):
for t in threads:
if type(t) == pulseaudio.X2goPulseAudio:
t.stop_thread()
- gevent.sleep(1)
del t
+ for t in threads:
+ if type(t) == guardian.X2goSessionGuardian:
+ t.stop_thread()
+ del t
+
+ gevent.sleep(1)
+
if e is not None:
raise e
diff --git a/x2go/guardian.py b/x2go/guardian.py
index 5b8ea01..817f86f 100644
--- a/x2go/guardian.py
+++ b/x2go/guardian.py
@@ -34,12 +34,6 @@ import copy
from cleanup import x2go_cleanup
import log
-_sigterm_received = False
-def _sigterm_handle(s, f):
- global _sigterm_received
- _sigterm_received = True
- return 0
-
class X2goSessionGuardian(threading.Thread):
"""\
L{X2goSessionGuardian} thread controls X2Go session threads and their sub-threads (like
@@ -103,11 +97,9 @@ class X2goSessionGuardian(threading.Thread):
The handler of this L{X2goSessionGuardian} thread.
"""
- global _sigterm_received
-
seconds = 0
self._keepalive = True
- while not _sigterm_received and self._keepalive:
+ while self._keepalive:
gevent.sleep(1)
seconds += 1
diff --git a/x2go/xserver.py b/x2go/xserver.py
index 217b577..666add1 100644
--- a/x2go/xserver.py
+++ b/x2go/xserver.py
@@ -212,6 +212,7 @@ class X2goXServer(threading.Thread):
self.xserver_name = xserver_name
self.xserver_config = xserver_config
+ self.hProcess = None
if self.xserver_config.has_key('display'):
self.logger('setting DISPLAY environment variable to %s' % self.xserver_config['display'], loglevel=log.loglevel_NOTICE)
os.environ.update({'DISPLAY': str(self.xserver_config['display'])})
@@ -219,6 +220,10 @@ class X2goXServer(threading.Thread):
self.daemon = True
self.start()
+ def __del__(self):
+
+ self._terminate_xserver()
+
def run(self):
"""\
Start this L{X2goXServer} thread. This will launch the configured XServer application.
@@ -241,16 +246,21 @@ class X2goXServer(threading.Thread):
None,
si,
)
- (hProcess, hThread, processId, threadId) = p_info
+ (self.hProcess, hThread, processId, threadId) = p_info
while self._keepalive:
gevent.sleep(1)
- self.logger('terminating running XServer ,,%s\'\'' % self.xserver_name, loglevel=log.loglevel_DEBUG)
- if _X2GOCLIENT_OS == 'Windows':
+ self._terminate_xserver()
+
+ def _terminate_xserver(self):
+
+ self.logger('terminating running XServer ,,%s\'\'' % self.xserver_name, loglevel=log.loglevel_DEBUG)
+
+ if _X2GOCLIENT_OS == 'Windows' and self.hProcess is not None:
try:
- win32process.TerminateProcess(hProcess, 0)
+ win32process.TerminateProcess(self.hProcess, 0)
except win32process.error:
self.logger('XServer ,,%s\'\' could not be terminated.' % self.xserver_name, loglevel=log.loglevel_DEBUG)
hooks/post-receive
--
python-x2go.git (Python X2Go Client API)
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "python-x2go.git" (Python X2Go Client API).
More information about the x2go-commits
mailing list