+ logger.debug('new ssh: {0}'.format(self._ssh))
+
+ logger.debug('Connect peer: {0}'.
+ format(self._ssh.get_transport().getpeername()))
+ logger.debug('Connections: {0}'.format(str(SSH.__existing_connections)))
+
+ def disconnect(self, node):
+ """Close SSH connection to the node.
+
+ :param node: The node to disconnect from.
+ :type node: dict
+ """
+ node_hash = self._node_hash(node)
+ if node_hash in SSH.__existing_connections:
+ logger.debug('Disconnecting peer: {}, {}'.
+ format(node['host'], node['port']))
+ ssh = SSH.__existing_connections.pop(node_hash)
+ ssh.close()
+
+ def _reconnect(self):
+ """Close the SSH connection and open it again."""
+
+ node = self._node
+ self.disconnect(node)
+ self.connect(node)
+ logger.debug('Reconnecting peer done: {}'.
+ format(self._ssh.get_transport().getpeername()))