The branch, master has been updated via 470dda06432bcaaa0989b6961700ec4e71c5a194 (commit) from 6d9eef295e1a3386d07015e00e4292400f8c4d7f (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 ----------------------------------------------------------------- commit 470dda06432bcaaa0989b6961700ec4e71c5a194 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Mon Jun 27 11:31:02 2011 +0200 Improve error handling / logging in forward.py. ----------------------------------------------------------------------- Summary of changes: debian/changelog | 1 + x2go/forward.py | 70 +++++++++++++++++++++++++++++------------------------ 2 files changed, 39 insertions(+), 32 deletions(-) The diff of changes is: diff --git a/debian/changelog b/debian/changelog index 0805825..c6dca3a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,7 @@ python-x2go (0.1.1.2-0~x2go1) UNRELEASED; urgency=low - Use X2goRegistryException for session query for non-existing sessions. - Catch this exception in X2goClient. - Fix desktop sharing. + - Improve error handling / logging in forward.py. -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Fri, 24 Jun 2011 16:42:20 +0200 diff --git a/x2go/forward.py b/x2go/forward.py index 34466d0..97b2162 100644 --- a/x2go/forward.py +++ b/x2go/forward.py @@ -103,7 +103,6 @@ class X2goFwServer(StreamServer): # it is recommended here to have passed on the session instance to this object... if self.session_instance: if not self.session_instance.is_connected(): - print 'HALLO' break _count += 1 @@ -118,44 +117,51 @@ class X2goFwServer(StreamServer): self.chain_port, _count, repr(e)), - loglevel=log.loglevel_ERROR) + loglevel=log.loglevel_WARN) gevent.sleep(.4) - # once we are here, we can presume the tunnel to be active... - self.is_active = True - if self.chan is None: - self.logger('incoming request to [%s]:%d was rejected by the SSH server.' % - (self.chain_host, self.chain_port), loglevel=log.loglevel_ERROR) - if self.session_instance: - self.session_instance.HOOK_forwarding_tunnel_setup_failed(chain_host=self.chain_host, chain_port=self.chain_port) - return + if not _success: + self.logger('incoming request to %s:%d failed after %d attempts' % (self.chain_host, + self.chain_port, + _count, + loglevel=log.loglevel_ERROR) else: - self.logger('connected! Tunnel open %r -> %r -> %r' % (self.fw_socket.getpeername(), + # once we are here, we can presume the tunnel to be active... + self.is_active = True + + if self.chan is None: + self.logger('incoming request to [%s]:%d was rejected by the SSH server.' % + (self.chain_host, self.chain_port), loglevel=log.loglevel_ERROR) + if self.session_instance: + self.session_instance.HOOK_forwarding_tunnel_setup_failed(chain_host=self.chain_host, chain_port=self.chain_port) + return + else: + self.logger('connected! Tunnel open %r -> %r -> %r' % (self.fw_socket.getpeername(), chan_peername, (self.chain_host, self.chain_port)), loglevel=log.loglevel_INFO) - self.keepalive = True - try: - while self.keepalive: - r, w, x = select.select([self.fw_socket, self.chan], [], []) - if fw_socket in r: - data = fw_socket.recv(1024) - if len(data) == 0: - break - self.chan.send(data) - if self.chan in r: - data = self.chan.recv(1024) - if len(data) == 0: - break - fw_socket.send(data) - self.close_channel() - self.close_socket() - except socket.error: - pass + self.keepalive = True + try: + while self.keepalive: + r, w, x = select.select([self.fw_socket, self.chan], [], []) + if fw_socket in r: + data = fw_socket.recv(1024) + if len(data) == 0: + break + self.chan.send(data) + if self.chan in r: + data = self.chan.recv(1024) + if len(data) == 0: + break + fw_socket.send(data) + self.close_channel() + self.close_socket() + except socket.error: + pass - self.is_active = False - self.logger('Tunnel closed from %r' % (chan_peername,), - loglevel=log.loglevel_INFO) + self.is_active = False + self.logger('Tunnel closed from %r' % (chan_peername,), + loglevel=log.loglevel_INFO) def close_channel(self): """\ 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).