summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOlle Lundberg <geek@nerd.sh>2014-08-13 17:18:51 +0200
committerOlle Lundberg <geek@nerd.sh>2014-08-13 17:43:06 +0200
commitc0e60de5291b9f7dc660147a9f9beb0b87b24c36 (patch)
tree4c594be5ec8dbf0cd9579103c0be5af97210d0c6
parent677285a3583b15c2bbd765816d5b62f4cb403965 (diff)
Add possibility to set default sizes.
This change adds two new parameters to the constructor of the Transport class. Letting the user set the default windows size and default max packet size for the instance.
-rw-r--r--paramiko/transport.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/paramiko/transport.py b/paramiko/transport.py
index 7776b9d7..d9a48247 100644
--- a/paramiko/transport.py
+++ b/paramiko/transport.py
@@ -135,7 +135,10 @@ class Transport (threading.Thread):
_modulus_pack = None
- def __init__(self, sock):
+ def __init__(self,
+ sock,
+ default_window_size=64 * 2 ** 15,
+ default_max_packet_size=2 ** 15):
"""
Create a new SSH session over an existing socket, or socket-like
object. This only creates the `.Transport` object; it doesn't begin the
@@ -163,6 +166,12 @@ class Transport (threading.Thread):
:param socket sock:
a socket or socket-like object to create the session over.
+ :param int default_window_size:
+ sets the default window size on the transport. (defaults to
+ 2097152)
+ :param int default_max_packet_size:
+ sets the default max packet size on the transport. (defaults to
+ 32768)
"""
if isinstance(sock, string_types):
# convert "host:port" into (host, port)
@@ -231,8 +240,8 @@ class Transport (threading.Thread):
self.channel_events = {} # (id -> Event)
self.channels_seen = {} # (id -> True)
self._channel_counter = 1
- self.default_max_packet_size = 2 ** 15
- self.default_window_size = 64 * self.default_max_packet_size
+ self.default_max_packet_size = default_max_packet_size
+ self.default_window_size = default_window_size
self._forward_agent_handler = None
self._x11_handler = None
self._tcp_handler = None