aboutsummaryrefslogtreecommitdiff
path: root/paramiko/packet.py
diff options
context:
space:
mode:
authorJeremy T. Bouse <jbouse@debian.org>2014-09-22 09:21:39 -0400
committerJeremy T. Bouse <jbouse@debian.org>2014-09-22 09:21:39 -0400
commitccd643cdbd7ba752727d62051058a4454451414d (patch)
tree9bc89a6629132f474b3297735069d025145a965c /paramiko/packet.py
parent588a4823436454e8968ee36ae95ff92e1cddc3f7 (diff)
downloadpython-paramiko-ccd643cdbd7ba752727d62051058a4454451414d.tar
python-paramiko-ccd643cdbd7ba752727d62051058a4454451414d.tar.gz
Imported Upstream version 1.15.0upstream/1.15.0
Diffstat (limited to 'paramiko/packet.py')
-rw-r--r--paramiko/packet.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/paramiko/packet.py b/paramiko/packet.py
index e97d92f..f516ff9 100644
--- a/paramiko/packet.py
+++ b/paramiko/packet.py
@@ -231,6 +231,7 @@ class Packetizer (object):
def write_all(self, out):
self.__keepalive_last = time.time()
+ iteration_with_zero_as_return_value = 0
while len(out) > 0:
retry_write = False
try:
@@ -254,6 +255,15 @@ class Packetizer (object):
n = 0
if self.__closed:
n = -1
+ else:
+ if n == 0 and iteration_with_zero_as_return_value > 10:
+ # We shouldn't retry the write, but we didn't
+ # manage to send anything over the socket. This might be an
+ # indication that we have lost contact with the remote side,
+ # but are yet to receive an EOFError or other socket errors.
+ # Let's give it some iteration to try and catch up.
+ n = -1
+ iteration_with_zero_as_return_value += 1
if n < 0:
raise EOFError()
if n == len(out):