Fixed forwarding scheme so it works with all platforms...

This commit is contained in:
Adolfo Gómez García 2015-04-13 13:55:18 +02:00
parent 250441056b
commit c3316a4745
2 changed files with 14 additions and 5 deletions

View File

@ -26,6 +26,9 @@ cd ../..
make DESTDIR=$RPM_BUILD_ROOT DISTRO=rh install make DESTDIR=$RPM_BUILD_ROOT DISTRO=rh install
cd $curdir cd $curdir
%post
/usr/bin/update-desktop-database
%clean %clean
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
curdir=`pwd` curdir=`pwd`
@ -37,6 +40,7 @@ cd $curdir
%postun %postun
# And, posibly, the .pyc leaved behind on /usr/share/UDSActor # And, posibly, the .pyc leaved behind on /usr/share/UDSActor
rm -rf /usr/share/UDClient > /dev/null 2>&1 rm -rf /usr/share/UDClient > /dev/null 2>&1
/usr/bin/update-desktop-database
%description %description
This package provides the required components to allow connection to services offered by UDS Broker. This package provides the required components to allow connection to services offered by UDS Broker.

View File

@ -23,7 +23,7 @@ class ForwardServer (SocketServer.ThreadingTCPServer):
class Handler (SocketServer.BaseRequestHandler): class Handler (SocketServer.BaseRequestHandler):
def handle(self): def handle(self):
self.thread.alreadyConnected = True self.thread.isConnected = True
try: try:
chan = self.ssh_transport.open_channel('direct-tcpip', chan = self.ssh_transport.open_channel('direct-tcpip',
@ -66,7 +66,10 @@ class Handler (SocketServer.BaseRequestHandler):
except Exception: except Exception:
pass pass
self.thread.stop() if self.thread.stoppable is True:
self.thread.stop()
self.thread.isConnected = False
def verbose(s): def verbose(s):
@ -96,12 +99,14 @@ class ForwardThread(threading.Thread):
self.stopEvent = threading.Event() self.stopEvent = threading.Event()
self.timer = None self.timer = None
self.alreadyConnected = False self.isConnected = False
self.stoppable = False
def _timerFnc(self): def _timerFnc(self):
self.timer = None self.timer = None
verbose('Timer fnc: {}'.format(self.alreadyConnected)) verbose('Timer fnc: {}'.format(self.isConnected))
if self.alreadyConnected is False: self.stoppable = True
if self.isConnected is False:
self.stop() self.stop()
def run(self): def run(self):