summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2012-11-29 15:18:40 -0800
committerJeff Forcier <jeff@bitprophet.org>2012-11-29 15:18:40 -0800
commit7a4d3c4e424e6669d091be495eb8a000b4815ebe (patch)
tree006153b15161bca3ca37f05c5c7b7669a0e3f27c
parent537f95dbb36c578e65cfd9cbc1a1eabc03f38428 (diff)
Revert "Make send() and recv() fail when channel is closed"
This reverts commit bc3674d0f0c61b5c7af9cfbc9248cf574d0998b0.
-rw-r--r--paramiko/channel.py19
1 files changed, 3 insertions, 16 deletions
diff --git a/paramiko/channel.py b/paramiko/channel.py
index 9a1bb874..1c9ae4bd 100644
--- a/paramiko/channel.py
+++ b/paramiko/channel.py
@@ -606,10 +606,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:
@@ -660,10 +656,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:
@@ -717,10 +709,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:
@@ -758,10 +746,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:
@@ -800,6 +784,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