Commit b2a433dc authored by David Wilson's avatar David Wilson

ssh: CompressionLevel is a v1-only option.

It's ignored by newer SSHes, which only pay attention to Compression.
parent b433645d
......@@ -596,7 +596,7 @@ Router Class
:py:class:`mitogen.core.StreamError` to be raised, and that
attributes of the stream match the actual behaviour of ``sudo``.
.. method:: ssh (hostname, username=None, ssh_path=None, port=None, check_host_keys=True, password=None, identity_file=None, compression_level=6, \**kwargs)
.. method:: ssh (hostname, username=None, ssh_path=None, port=None, check_host_keys=True, password=None, identity_file=None, compression=True, \**kwargs)
Arrange for a context to be constructed over a ``ssh`` invocation. The
``ssh`` process is started in a newly allocated pseudo-terminal, and
......@@ -628,10 +628,12 @@ Router Class
the SSH client to perform authenticaion; agent authentication is
automatically disabled, as is reading the default private key from
``~/.ssh/id_rsa``, or ``~/.ssh/id_dsa``.
:param int compression_level:
Integer 0-9 representing the zlib compression level to use on the
connection, with 0 indicating compression is disabled. Defaults to
6.
:param bool compression:
If :py:data:`True`, enable ``ssh`` compression support. Compression
has a minimal effect on the size of modules transmitted, as they
are already compressed, however it has a large effect on every
remaining message in the otherwise uncompressed stream protocol,
such as function call arguments and return values.
Context Class
......
......@@ -61,7 +61,7 @@ class Stream(mitogen.parent.Stream):
def construct(self, hostname, username=None, ssh_path=None, port=None,
check_host_keys=True, password=None, identity_file=None,
compression_level=6, ssh_args=None, **kwargs):
compression=True, ssh_args=None, **kwargs):
super(Stream, self).construct(**kwargs)
self.hostname = hostname
self.username = username
......@@ -69,7 +69,7 @@ class Stream(mitogen.parent.Stream):
self.check_host_keys = check_host_keys
self.password = password
self.identity_file = identity_file
self.compression_level = compression_level
self.compression = compression
if ssh_path:
self.ssh_path = ssh_path
if ssh_args:
......@@ -87,11 +87,8 @@ class Stream(mitogen.parent.Stream):
bits += ['-o', 'IdentitiesOnly yes']
if self.identity_file:
bits += ['-i', self.identity_file]
if self.compression_level:
bits += [
'-o', 'Compression yes',
'-o', 'CompressionLevel %d' % (self.compression_level,)
]
if self.compression:
bits += ['-o', 'Compression yes']
if not self.check_host_keys:
bits += [
'-o', 'StrictHostKeyChecking no',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment