[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] channel: check for closed state in waitwindow loops
[Thread Prev] | [Thread Next]
- Subject: [PATCH] channel: check for closed state in waitwindow loops
- From: Jon Simons <jon@xxxxxxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Wed, 19 Mar 2014 19:53:49 -0700
- To: libssh@xxxxxxxxxx
Hi, Attached is a patch for also checking the current channel's close state in the 'waitwindow' loops. With this patch I was able to fix an issue I hit while testing with multiple channels per client session. Sometimes a channel close would not otherwise be detected in these loops. -Jon
From 76b56f2f7a6fc69cefdf8d21473a75476a79e8bc Mon Sep 17 00:00:00 2001
From: Jon Simons <jon@xxxxxxxxxxxxx>
Date: Wed, 26 Feb 2014 18:51:24 -0800
Subject: [PATCH] channel: check for closed state in waitwindow loops
Signed-off-by: Jon Simons <jon@xxxxxxxxxxxxx>
---
src/channels.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/channels.c b/src/channels.c
index 51e96fe..85a3ebc 100644
--- a/src/channels.c
+++ b/src/channels.c
@@ -1238,7 +1238,8 @@ error:
static int ssh_channel_waitwindow_termination(void *c){
ssh_channel channel = (ssh_channel) c;
if (channel->remote_window > 0 ||
- channel->session->session_state == SSH_SESSION_STATE_ERROR)
+ channel->session->session_state == SSH_SESSION_STATE_ERROR ||
+ channel->state == SSH_CHANNEL_STATE_CLOSED)
return 1;
else
return 0;
@@ -1345,7 +1346,8 @@ int channel_write_common(ssh_channel channel, const void *data,
ssh_channel_waitwindow_termination,channel);
if (rc == SSH_ERROR ||
!ssh_channel_waitwindow_termination(channel) ||
- channel->session->session_state == SSH_SESSION_STATE_ERROR)
+ channel->session->session_state == SSH_SESSION_STATE_ERROR ||
+ channel->state == SSH_CHANNEL_STATE_CLOSED)
goto out;
continue;
}
--
1.8.4.21.g992c386
Archive administrator: postmaster@lists.cynapses.org