Blame SOURCES/0105-curl-7.32.0-scp-upload.patch

9d7d3f
From 2e973be50f75d0a85dcb995f7823f00b1fc85c2f Mon Sep 17 00:00:00 2001
9d7d3f
From: Kamil Dudka <kdudka@redhat.com>
9d7d3f
Date: Mon, 7 Oct 2013 16:07:50 +0200
9d7d3f
Subject: [PATCH] ssh: improve the logic for detecting blocking direction
9d7d3f
9d7d3f
This fixes a regression introduced by commit 0feeab78 limiting the speed
9d7d3f
of SCP upload to 16384 B/s on a fast connection (such as localhost).
9d7d3f
9d7d3f
[upstream commit d015f4ccac627852869cb45e31ccdc9fbd97dc47]
9d7d3f
---
9d7d3f
 lib/ssh.c |    8 +++++---
9d7d3f
 1 files changed, 5 insertions(+), 3 deletions(-)
9d7d3f
9d7d3f
diff --git a/lib/ssh.c b/lib/ssh.c
9d7d3f
index 422357b..93c65c3 100644
9d7d3f
--- a/lib/ssh.c
9d7d3f
+++ b/lib/ssh.c
9d7d3f
@@ -2287,6 +2287,10 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
9d7d3f
         sshc->actualcode = result;
9d7d3f
       }
9d7d3f
       else {
9d7d3f
+        /* store this original bitmask setup to use later on if we can't
9d7d3f
+           figure out a "real" bitmask */
9d7d3f
+        sshc->orig_waitfor = data->req.keepon;
9d7d3f
+
9d7d3f
         /* we want to use the _sending_ function even when the socket turns
9d7d3f
            out readable as the underlying libssh2 scp send function will deal
9d7d3f
            with both accordingly */
9d7d3f
@@ -2603,9 +2607,7 @@ static void ssh_block2waitfor(struct connectdata *conn, bool block)
9d7d3f
 {
9d7d3f
   struct ssh_conn *sshc = &conn->proto.sshc;
9d7d3f
   int dir;
9d7d3f
-  if(!block)
9d7d3f
-    conn->waitfor = 0;
9d7d3f
-  else if((dir = libssh2_session_block_directions(sshc->ssh_session))) {
9d7d3f
+  if(block && (dir = libssh2_session_block_directions(sshc->ssh_session))) {
9d7d3f
     /* translate the libssh2 define bits into our own bit defines */
9d7d3f
     conn->waitfor = ((dir&LIBSSH2_SESSION_BLOCK_INBOUND)?KEEP_RECV:0) |
9d7d3f
       ((dir&LIBSSH2_SESSION_BLOCK_OUTBOUND)?KEEP_SEND:0);
9d7d3f
-- 
9d7d3f
1.7.1
9d7d3f