Create persistent socket path using port and connection type (#28492)

* Create persistent socket path using port and connection type

*  Use remote address, port, connection type and remote user
   to create a socket path.

* Fix review comment
pull/28581/head
Ganesh Nalawade 7 years ago committed by Brian Coca
parent 9407a17c40
commit cd8c1c1108

@ -295,7 +295,7 @@ def main():
sys.exit("FAIL: %s" % e) sys.exit("FAIL: %s" % e)
ssh = connection_loader.get('ssh', class_only=True) ssh = connection_loader.get('ssh', class_only=True)
cp = ssh._create_control_path(pc.remote_addr, pc.port, pc.remote_user) cp = ssh._create_control_path(pc.remote_addr, pc.port, pc.remote_user, pc.connection)
# create the persistent connection dir if need be and create the paths # create the persistent connection dir if need be and create the paths
# which we will be using later # which we will be using later

@ -268,9 +268,11 @@ class Connection(ConnectionBase):
sock.close() sock.close()
@staticmethod @staticmethod
def _create_control_path(host, port, user): def _create_control_path(host, port, user, connection=None):
'''Make a hash for the controlpath based on con attributes''' '''Make a hash for the controlpath based on con attributes'''
pstring = '%s-%s-%s' % (host, port, user) pstring = '%s-%s-%s' % (host, port, user)
if connection:
pstring += '-%s' % connection
m = hashlib.sha1() m = hashlib.sha1()
m.update(to_bytes(pstring)) m.update(to_bytes(pstring))
digest = m.hexdigest() digest = m.hexdigest()

Loading…
Cancel
Save