Extra safety feature to avoid sending SSH2_MSG_WINDOW_ADJUST on
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Thu, 10 Jan 2002 13:29:43 +0000 (13:29 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Thu, 10 Jan 2002 13:29:43 +0000 (13:29 +0000)
a nonexistent channel. I don't quite know why this was happening,
but whatever it was this ought to fix it.

git-svn-id: svn://svn.tartarus.org/sgt/putty@1540 cda61777-01e9-0310-a592-d414129be87e

ssh.c

diff --git a/ssh.c b/ssh.c
index b8abc5b..8fac568 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -3734,6 +3734,14 @@ static int ssh2_try_send(struct ssh_channel *c)
  */
 static void ssh2_set_window(struct ssh_channel *c, unsigned newwin)
 {
+    /*
+     * Never send WINDOW_ADJUST for a channel that the remote side
+     * already thinks it's closed; there's no point, since it won't
+     * be sending any more data anyway.
+     */
+    if (c->closes != 0)
+       return;
+
     if (newwin > c->v.v2.locwindow) {
        ssh2_pkt_init(SSH2_MSG_CHANNEL_WINDOW_ADJUST);
        ssh2_pkt_adduint32(c->remoteid);