summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2013-09-16 08:49:26 +0200
committerAndreas Schneider <asn@cryptomilk.org>2013-10-01 14:47:57 +0200
commitc59568c3c1c80e3bb7e9844c16c6c3edfc2b2dba (patch)
treec2001efac761e3a57c989f3f1eacaa48185b648d
parent6f10422685fd839dd35d6b3d6657caf701d1fba2 (diff)
channels: Correctly decrement timeout value in ssh_channel_accept().
BUG: https://red.libssh.org/issues/116
-rw-r--r--src/channels.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/channels.c b/src/channels.c
index 48ca81d5..fdd60655 100644
--- a/src/channels.c
+++ b/src/channels.c
@@ -1958,8 +1958,11 @@ static ssh_channel ssh_channel_accept(ssh_session session, int channeltype,
struct ssh_iterator *iterator;
int t;
- for (t = timeout_ms; t >= 0; t -= 50)
- {
+ /*
+ * We sleep for 50 ms in ssh_handle_packets() and later sleep for
+ * 50 ms. So we need to decrement by 100 ms.
+ */
+ for (t = timeout_ms; t >= 0; t -= 100) {
ssh_handle_packets(session, 50);
if (session->ssh_message_list) {