diff --git a/paramiko/transport.py b/paramiko/transport.py index 97026e8..541b29d 100644 --- a/paramiko/transport.py +++ b/paramiko/transport.py @@ -269,7 +269,7 @@ class BaseTransport (threading.Thread): @rtype: str """ - out = ' 0: try: n = self.sock.send(out) - except: + except Exception, x: # could be: (32, 'Broken pipe') n = -1 if n < 0: @@ -1062,10 +1064,13 @@ class BaseTransport (threading.Thread): return self._cipher_info[name]['class'].new(key, self._cipher_info[name]['mode'], iv) def _run(self): - self.active = True + # active=True occurs before the thread is launched, to avoid a race _active_threads.append(self) + if self.server_mode: + self._log(DEBUG, 'starting thread (server mode): %s' % hex(long(id(self)) & 0xffffffffL)) + else: + self._log(DEBUG, 'starting thread (client mode): %s' % hex(long(id(self)) & 0xffffffffL)) try: - # SSH-1.99-OpenSSH_2.9p2 self._write_all(self.local_version + '\r\n') self._check_banner() self._send_kex_init()