Skip to content

Commit

Permalink
Add possibility to set default sizes.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lndbrg committed Aug 13, 2014
1 parent 677285a commit c0e60de
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions paramiko/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -163,6 +166,12 @@ def __init__(self, sock):
: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)
Expand Down Expand Up @@ -231,8 +240,8 @@ def __init__(self, sock):
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
Expand Down

0 comments on commit c0e60de

Please sign in to comment.