@@ -127,7 +127,7 @@ def __init__(self, host,
127127 self ._connect_tunnel ()
128128 else :
129129 self ._connect (self .client , self .host , self .port )
130-
130+
131131 def _connect_tunnel (self ):
132132 """Connects to SSH server via an intermediate SSH tunnel server.
133133 client (me) -> tunnel (ssh server to proxy through) -> \
@@ -145,14 +145,15 @@ def _connect_tunnel(self):
145145 self .proxy_port , self .host , self .port ,)
146146 try :
147147 proxy_channel = self .proxy_client .get_transport ().open_channel (
148- 'direct-tcpip' , (self .host , self .port ,), ('127.0.0.1' , 0 ))
148+ 'direct-tcpip' , (self .host , self .port ,), ('127.0.0.1' , 0 ),
149+ timeout = self .timeout )
149150 sleep (0 )
150151 return self ._connect (self .client , self .host , self .port , sock = proxy_channel )
151- except ChannelException as ex :
152+ except ( ChannelException , paramiko . SSHException ) as ex :
152153 error_type = ex .args [1 ] if len (ex .args ) > 1 else ex .args [0 ]
153154 raise ConnectionErrorException ("Error connecting to host '%s:%s' - %s" ,
154- self .host , self .port ,
155- str (error_type ))
155+ self .host , self .port ,
156+ str (error_type ))
156157
157158 def _connect (self , client , host , port , sock = None , retries = 1 ,
158159 user = None , password = None , pkey = None ):
0 commit comments