summaryrefslogtreecommitdiff
path: root/lib/vssh
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2021-06-17 10:25:53 +0200
committerDaniel Stenberg <daniel@haxx.se>2021-06-17 17:06:31 +0200
commitfa34353d07e1d3053ae55b91d3971edf548d238a (patch)
tree0a6a53a59e61a3de991e3f641180947911ec9660 /lib/vssh
parent720b4a1a437759cb31b8283299e2e5e4289757e7 (diff)
downloadcurl-fa34353d07e1d3053ae55b91d3971edf548d238a.tar.gz
libssh2: limit time a disconnect can take to 1 second
Closes #7271
Diffstat (limited to 'lib/vssh')
-rw-r--r--lib/vssh/libssh2.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/vssh/libssh2.c b/lib/vssh/libssh2.c
index 8a6345b94..ec9474709 100644
--- a/lib/vssh/libssh2.c
+++ b/lib/vssh/libssh2.c
@@ -2938,6 +2938,7 @@ static CURLcode ssh_block_statemach(struct Curl_easy *data,
{
struct ssh_conn *sshc = &conn->proto.sshc;
CURLcode result = CURLE_OK;
+ struct curltime dis = Curl_now();
while((sshc->state != SSH_STOP) && !result) {
bool block;
@@ -2962,6 +2963,12 @@ static CURLcode ssh_block_statemach(struct Curl_easy *data,
return CURLE_OPERATION_TIMEDOUT;
}
}
+ else if(Curl_timediff(now, dis) > 1000) {
+ /* disconnect timeout */
+ failf(data, "Disconnect timed out");
+ result = CURLE_OK;
+ break;
+ }
if(block) {
int dir = libssh2_session_block_directions(sshc->ssh_session);