Revert "Make send() and recv() fail when channel is closed"
This reverts commit bc3674d0f0
.
This commit is contained in:
parent
537f95dbb3
commit
7a4d3c4e42
|
@ -606,10 +606,6 @@ class Channel (object):
|
||||||
@raise socket.timeout: if no data is ready before the timeout set by
|
@raise socket.timeout: if no data is ready before the timeout set by
|
||||||
L{settimeout}.
|
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:
|
try:
|
||||||
out = self.in_buffer.read(nbytes, self.timeout)
|
out = self.in_buffer.read(nbytes, self.timeout)
|
||||||
except PipeTimeout, e:
|
except PipeTimeout, e:
|
||||||
|
@ -660,10 +656,6 @@ class Channel (object):
|
||||||
|
|
||||||
@since: 1.1
|
@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:
|
try:
|
||||||
out = self.in_stderr_buffer.read(nbytes, self.timeout)
|
out = self.in_stderr_buffer.read(nbytes, self.timeout)
|
||||||
except PipeTimeout, e:
|
except PipeTimeout, e:
|
||||||
|
@ -717,10 +709,6 @@ class Channel (object):
|
||||||
@raise socket.timeout: if no data could be sent before the timeout set
|
@raise socket.timeout: if no data could be sent before the timeout set
|
||||||
by L{settimeout}.
|
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)
|
size = len(s)
|
||||||
self.lock.acquire()
|
self.lock.acquire()
|
||||||
try:
|
try:
|
||||||
|
@ -758,10 +746,6 @@ class Channel (object):
|
||||||
|
|
||||||
@since: 1.1
|
@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)
|
size = len(s)
|
||||||
self.lock.acquire()
|
self.lock.acquire()
|
||||||
try:
|
try:
|
||||||
|
@ -800,6 +784,9 @@ class Channel (object):
|
||||||
This is irritating, but identically follows python's API.
|
This is irritating, but identically follows python's API.
|
||||||
"""
|
"""
|
||||||
while s:
|
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)
|
sent = self.send(s)
|
||||||
s = s[sent:]
|
s = s[sent:]
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Reference in New Issue