diff options
author | Jeff Forcier <jeff@bitprophet.org> | 2012-11-29 15:19:56 -0800 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2012-11-29 15:19:56 -0800 |
commit | 531606b0d6ebb46f8f36de554a571d96790ce3f8 (patch) | |
tree | 1541f2dba59f418f4acdfe7f5bcf79197cd48d09 | |
parent | 2223aa10ccc473c440de7233e9daa69019a8bb01 (diff) |
Revert "Make send() and recv() fail when channel is closed"
This reverts commit 23f3099b6f7808934400b96b707e122ed2dd302c.
-rw-r--r-- | paramiko/channel.py | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/paramiko/channel.py b/paramiko/channel.py index 35991deb..534f8d7c 100644 --- a/paramiko/channel.py +++ b/paramiko/channel.py @@ -605,10 +605,6 @@ class Channel (object): @raise socket.timeout: if no data is ready before the timeout set by L{settimeout}. """ - if self.closed: - # this doesn't seem useful, but it is the documented behavior of Socket - raise socket.error(errno.EBADF, 'Socket is closed') - try: out = self.in_buffer.read(nbytes, self.timeout) except PipeTimeout, e: @@ -659,10 +655,6 @@ class Channel (object): @since: 1.1 """ - if self.closed: - # this doesn't seem useful, but it is the documented behavior of Socket - raise socket.error(errno.EBADF, 'Socket is closed') - try: out = self.in_stderr_buffer.read(nbytes, self.timeout) except PipeTimeout, e: @@ -716,10 +708,6 @@ class Channel (object): @raise socket.timeout: if no data could be sent before the timeout set by L{settimeout}. """ - if self.closed: - # this doesn't seem useful, but it is the documented behavior of Socket - raise socket.error(errno.EBADF, 'Socket is closed') - size = len(s) self.lock.acquire() try: @@ -757,10 +745,6 @@ class Channel (object): @since: 1.1 """ - if self.closed: - # this doesn't seem useful, but it is the documented behavior of Socket - raise socket.error(errno.EBADF, 'Socket is closed') - size = len(s) self.lock.acquire() try: @@ -799,6 +783,9 @@ class Channel (object): This is irritating, but identically follows python's API. """ while s: + if self.closed: + # this doesn't seem useful, but it is the documented behavior of Socket + raise socket.error('Socket is closed') sent = self.send(s) s = s[sent:] return None |