aboutsummaryrefslogtreecommitdiff
path: root/lib/ssh.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2007-02-02 15:26:57 +0000
committerDaniel Stenberg <daniel@haxx.se>2007-02-02 15:26:57 +0000
commitabe90019d33362264b84dd56a73f25216e757e04 (patch)
tree2113ab92630c47e6ac651c076f25975e77ab92f3 /lib/ssh.c
parentc185cdf2b49d814b0a226981d5b18e902c4c8b88 (diff)
prefer using the (upcoming) non-blocking libssh2 API
Diffstat (limited to 'lib/ssh.c')
-rw-r--r--lib/ssh.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/ssh.c b/lib/ssh.c
index 24cba1bac..375447a8b 100644
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -627,9 +627,10 @@ ssize_t Curl_scp_send(struct connectdata *conn, int sockindex,
* a regular CURLcode value.
*/
ssize_t Curl_scp_recv(struct connectdata *conn, int sockindex,
- char *mem, size_t len)
+ char *mem, size_t len)
{
ssize_t nread;
+ (void)sockindex; /* we only support SCP on the fixed known primary socket */
/* libssh2_channel_read() returns int
*
@@ -637,10 +638,16 @@ ssize_t Curl_scp_recv(struct connectdata *conn, int sockindex,
* in the SessionHandle struct
*/
+#ifdef LIBSSH2CHANNEL_EAGAIN
+ /* we prefer the non-blocking API but that didn't exist previously */
+ nread = (ssize_t)
+ libssh2_channel_readnb(conn->data->reqdata.proto.ssh->ssh_channel,
+ mem, len);
+#else
nread = (ssize_t)
libssh2_channel_read(conn->data->reqdata.proto.ssh->ssh_channel,
mem, len);
- (void)sockindex;
+#endif
return nread;
}