From 2d9ad663ba6c2083a335d5863ee8d2d31d763ec9 Mon Sep 17 00:00:00 2001 From: Robey Pointer Date: Mon, 13 Dec 2004 07:27:39 +0000 Subject: [PATCH] [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-130] small fixups move _wait_for_send_window into the right place in Channel. remove outdated note from auth_transport. fix download url in setup.py. --- paramiko/auth_transport.py | 6 --- paramiko/channel.py | 76 +++++++++++++++++++------------------- setup.py | 2 +- 3 files changed, 39 insertions(+), 45 deletions(-) diff --git a/paramiko/auth_transport.py b/paramiko/auth_transport.py index d4053e4..00aba9c 100644 --- a/paramiko/auth_transport.py +++ b/paramiko/auth_transport.py @@ -41,12 +41,6 @@ class Transport (BaseTransport): encrypted session, authenticates, and then creates stream tunnels, called L{Channel}s, across the session. Multiple channels can be multiplexed across a single session (and often are, in the case of port forwardings). - - @note: Because each Transport has a worker thread running in the - background, you must call L{close} on the Transport to kill this thread. - On many platforms, the python interpreter will refuse to exit cleanly if - any of these threads are still running (and you'll have to C{kill -9} from - another shell window). """ def __init__(self, sock): diff --git a/paramiko/channel.py b/paramiko/channel.py index 87a2aea..89b6e3f 100644 --- a/paramiko/channel.py +++ b/paramiko/channel.py @@ -782,44 +782,6 @@ class Channel (object): def _request_failed(self, m): self.close() - def _wait_for_send_window(self, size): - """ - (You are already holding the lock.) - Wait for the send window to open up, and allocate up to C{size} bytes - for transmission. If no space opens up before the timeout, a timeout - exception is raised. Returns the number of bytes available to send - (may be less than requested). - """ - # you are already holding the lock - if self.closed or self.eof_sent: - return 0 - if self.out_window_size == 0: - # should we block? - if self.timeout == 0.0: - raise socket.timeout() - # loop here in case we get woken up but a different thread has filled the buffer - timeout = self.timeout - while self.out_window_size == 0: - if self.closed or self.eof_sent: - return 0 - then = time.time() - self.out_buffer_cv.wait(timeout) - if timeout != None: - timeout -= time.time() - then - if timeout <= 0.0: - raise socket.timeout() - # we have some window to squeeze into - if self.closed: - return 0 - if self.out_window_size < size: - size = self.out_window_size - if self.out_max_packet_size - 64 < size: - size = self.out_max_packet_size - 64 - self.out_window_size -= size - if self.ultra_debug: - self._log(DEBUG, 'window down to %d' % self.out_window_size) - return size - def _feed(self, m): if type(m) is str: # passed from _feed_extended @@ -1083,6 +1045,44 @@ class Channel (object): self.transport._send_user_message(m) self.in_window_sofar = 0 + def _wait_for_send_window(self, size): + """ + (You are already holding the lock.) + Wait for the send window to open up, and allocate up to C{size} bytes + for transmission. If no space opens up before the timeout, a timeout + exception is raised. Returns the number of bytes available to send + (may be less than requested). + """ + # you are already holding the lock + if self.closed or self.eof_sent: + return 0 + if self.out_window_size == 0: + # should we block? + if self.timeout == 0.0: + raise socket.timeout() + # loop here in case we get woken up but a different thread has filled the buffer + timeout = self.timeout + while self.out_window_size == 0: + if self.closed or self.eof_sent: + return 0 + then = time.time() + self.out_buffer_cv.wait(timeout) + if timeout != None: + timeout -= time.time() - then + if timeout <= 0.0: + raise socket.timeout() + # we have some window to squeeze into + if self.closed: + return 0 + if self.out_window_size < size: + size = self.out_window_size + if self.out_max_packet_size - 64 < size: + size = self.out_max_packet_size - 64 + self.out_window_size -= size + if self.ultra_debug: + self._log(DEBUG, 'window down to %d' % self.out_window_size) + return size + class ChannelFile (BufferedFile): """ diff --git a/setup.py b/setup.py index 5b5dd55..ab4ba36 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ setup(name = "paramiko", author_email = "robey@lag.net", url = "http://www.lag.net/paramiko/", packages = [ 'paramiko' ], - download_url = 'http://www.lag.net/paramiko/paramiko-1.1.zip', + download_url = 'http://www.lag.net/paramiko/download/paramiko-1.1.zip', license = 'LGPL', platforms = 'Posix; MacOS X; Windows', classifiers = [ 'Development Status :: 3 - Alpha',