aboutsummaryrefslogtreecommitdiff
path: root/lib/ssh.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2011-03-13 23:21:03 +0100
committerDaniel Stenberg <daniel@haxx.se>2011-03-13 23:21:03 +0100
commit3eac14b43c62717cc14733aba6827c0c3d38dc9a (patch)
treef4bce1b937b546536d4ac43cae12c77169e673ec /lib/ssh.c
parent60406ff7f87c950be8eee96760f9358547594bc6 (diff)
SSH: add protocol lock direction
Some protocols have to call the underlying functions without regard to what exact state the socket signals. For example even if the socket says "readable", the send function might need to be called while uploading, or vice versa. This is the case for libssh2 based protocols: SCP and SFTP and we now introduce a define to set those protocols and we make the multi interface code aware of this concept. This is another fix to make test 582 run properly.
Diffstat (limited to 'lib/ssh.c')
-rw-r--r--lib/ssh.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/ssh.c b/lib/ssh.c
index 118611efc..e85ad2631 100644
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -2028,8 +2028,9 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
/* not set by Curl_setup_transfer to preserve keepon bits */
conn->writesockfd = conn->sockfd;
- /* FIXME: here should be explained why we need it to start the
- * download */
+ /* we want to use the _receiving_ function even when the socket turns
+ out writableable as the underlying libssh2 recv function will deal
+ with both accordingly */
conn->cselect_bits = CURL_CSELECT_IN;
}
if(result) {
@@ -2161,6 +2162,11 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
sshc->actualcode = result;
}
else {
+ /* we want to use the _sending_ function even when the socket turns
+ out readable as the underlying libssh2 scp send function will deal
+ with both accordingly */
+ conn->cselect_bits = CURL_CSELECT_OUT;
+
state(conn, SSH_STOP);
}
break;
@@ -2207,8 +2213,9 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
/* not set by Curl_setup_transfer to preserve keepon bits */
conn->writesockfd = conn->sockfd;
- /* FIXME: here should be explained why we need it to start the
- * download */
+ /* we want to use the _receiving_ function even when the socket turns
+ out writableable as the underlying libssh2 recv function will deal
+ with both accordingly */
conn->cselect_bits = CURL_CSELECT_IN;
if(result) {