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
This commit is contained in:
Ganesh Nalawade 2017-08-23 18:28:44 -04:00 committed by Brian Coca
parent 9407a17c40
commit cd8c1c1108
2 changed files with 4 additions and 2 deletions

View file

@ -268,9 +268,11 @@ class Connection(ConnectionBase):
sock.close()
@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'''
pstring = '%s-%s-%s' % (host, port, user)
if connection:
pstring += '-%s' % connection
m = hashlib.sha1()
m.update(to_bytes(pstring))
digest = m.hexdigest()