From e8db0472e60bdbfbbc38ef4f13906e3333717acb Mon Sep 17 00:00:00 2001 From: Claudio-Daniel Freire <claudio-daniel.freire@inria.fr> Date: Mon, 3 Oct 2011 07:58:21 +0200 Subject: [PATCH] Enable usage of persistent connections with popen_scp (limited though) --- src/nepi/util/server.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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) -- 2.47.0