From: Claudio-Daniel Freire Date: Mon, 3 Oct 2011 05:58:21 +0000 (+0200) Subject: Enable usage of persistent connections with popen_scp (limited though) X-Git-Tag: nepi-3.0.0~177 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=e8db0472e60bdbfbbc38ef4f13906e3333717acb;p=nepi.git Enable usage of persistent connections with popen_scp (limited though) --- diff --git a/src/nepi/util/server.py b/src/nepi/util/server.py index 4430d6ef..6f695779 100644 --- a/src/nepi/util/server.py +++ b/src/nepi/util/server.py @@ -864,7 +864,12 @@ def popen_scp(source, dest, tmp_known_hosts = None args = ['scp', '-q', '-p', '-C', # Don't bother with localhost. Makes test easier - '-o', 'NoHostAuthenticationForLocalhost=yes' ] + '-o', 'NoHostAuthenticationForLocalhost=yes', + '-o', 'ConnectTimeout=30', + '-o', 'ConnectionAttempts=3', + '-o', 'ServerAliveInterval=30', + '-o', 'TCPKeepAlive=yes' ] + if port: args.append('-P%d' % port) if recursive: @@ -878,6 +883,11 @@ def popen_scp(source, dest, if isinstance(source,list): args.extend(source) else: + if openssh_has_persist(): + connkey = make_connkey(user,host,port) + args.extend([ + '-o', 'ControlMaster=no', + '-o', 'ControlPath=/tmp/nepi_ssh_pl_%s' % ( connkey, ) ]) args.append(source) args.append(dest)