From 3e5bd84cc58fc6db485c5a188ac0ef90280b2804 Mon Sep 17 00:00:00 2001 From: Robey Pointer Date: Fri, 25 Mar 2005 20:06:56 +0000 Subject: [PATCH] [project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-155] fix sending of large sftp packet sizes fix a bug where packets larger than about 12KB would cause the session to die on platforms other than osx. turns out that on most platforms, setting a socket timeout also causes timeouts to occur on writes (but not on osx). so on a huge write, once the os buffers were full, paramiko would get a socket.timeout exception when writing, and bail. since the timeout is primarily so we can periodically poll to see if the session has been killed from elsewhere, do that on a timeout but otherwise continue trying to write. large packet sizes (in sftp) should now work. --- paramiko/transport.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/paramiko/transport.py b/paramiko/transport.py index b03e007..f8a5236 100644 --- a/paramiko/transport.py +++ b/paramiko/transport.py @@ -889,6 +889,10 @@ class BaseTransport (threading.Thread): while len(out) > 0: try: n = self.sock.send(out) + except socket.timeout: + n = 0 + if not self.active: + n = -1 except Exception, x: # could be: (32, 'Broken pipe') n = -1