diff options
-rw-r--r-- | paramiko/auth_transport.py | 6 | ||||
-rw-r--r-- | paramiko/channel.py | 76 | ||||
-rw-r--r-- | setup.py | 2 |
3 files changed, 39 insertions, 45 deletions
diff --git a/paramiko/auth_transport.py b/paramiko/auth_transport.py index d4053e4b..00aba9cc 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 87a2aea2..89b6e3f3 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): """ @@ -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', |