Merge "Allow disabling of long-lived SSH connections."
This commit is contained in:
@@ -277,7 +277,7 @@ class SSHPool(pools.Pool):
|
|||||||
self.port = port
|
self.port = port
|
||||||
self.login = login
|
self.login = login
|
||||||
self.password = password
|
self.password = password
|
||||||
self.conn_timeout = conn_timeout
|
self.conn_timeout = conn_timeout if conn_timeout else None
|
||||||
self.privatekey = privatekey
|
self.privatekey = privatekey
|
||||||
super(SSHPool, self).__init__(*args, **kwargs)
|
super(SSHPool, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
@@ -310,6 +310,7 @@ class SSHPool(pools.Pool):
|
|||||||
# the sockettimeout to None and setting a keepalive packet so that,
|
# the sockettimeout to None and setting a keepalive packet so that,
|
||||||
# the server will keep the connection open. All that does is send
|
# the server will keep the connection open. All that does is send
|
||||||
# a keepalive packet every ssh_conn_timeout seconds.
|
# a keepalive packet every ssh_conn_timeout seconds.
|
||||||
|
if self.conn_timeout:
|
||||||
transport = ssh.get_transport()
|
transport = ssh.get_transport()
|
||||||
transport.sock.settimeout(None)
|
transport.sock.settimeout(None)
|
||||||
transport.set_keepalive(self.conn_timeout)
|
transport.set_keepalive(self.conn_timeout)
|
||||||
|
|||||||
Reference in New Issue
Block a user