[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.
This commit is contained in:
Robey Pointer 2004-12-13 07:27:39 +00:00
parent ee0d4ae68e
commit 2d9ad663ba
3 changed files with 39 additions and 45 deletions

View File

@ -41,12 +41,6 @@ class Transport (BaseTransport):
encrypted session, authenticates, and then creates stream tunnels, called encrypted session, authenticates, and then creates stream tunnels, called
L{Channel}s, across the session. Multiple channels can be multiplexed L{Channel}s, across the session. Multiple channels can be multiplexed
across a single session (and often are, in the case of port forwardings). 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): def __init__(self, sock):

View File

@ -782,44 +782,6 @@ class Channel (object):
def _request_failed(self, m): def _request_failed(self, m):
self.close() 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): def _feed(self, m):
if type(m) is str: if type(m) is str:
# passed from _feed_extended # passed from _feed_extended
@ -1083,6 +1045,44 @@ class Channel (object):
self.transport._send_user_message(m) self.transport._send_user_message(m)
self.in_window_sofar = 0 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): class ChannelFile (BufferedFile):
""" """

View File

@ -19,7 +19,7 @@ setup(name = "paramiko",
author_email = "robey@lag.net", author_email = "robey@lag.net",
url = "http://www.lag.net/paramiko/", url = "http://www.lag.net/paramiko/",
packages = [ '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', license = 'LGPL',
platforms = 'Posix; MacOS X; Windows', platforms = 'Posix; MacOS X; Windows',
classifiers = [ 'Development Status :: 3 - Alpha', classifiers = [ 'Development Status :: 3 - Alpha',