]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
If the SSH server sends us CHANNEL_CLOSE for a channel on which we're
authorSimon Tatham <anakin@pobox.com>
Sun, 21 Jul 2013 10:12:58 +0000 (10:12 +0000)
committerSimon Tatham <anakin@pobox.com>
Sun, 21 Jul 2013 10:12:58 +0000 (10:12 +0000)
sitting on a pile of buffered data waiting for WINDOW_ADJUSTs, we
should throw away that buffered data, because the CHANNEL_CLOSE tells
us that we won't be receiving those WINDOW_ADJUSTs, and if we hang on
to the data and keep trying then it'll prevent ssh_channel_try_eof
from sending the CHANNEL_EOF which is a prerequisite of sending our
own CHANNEL_CLOSE.

[originally from svn r9953]

ssh.c

diff --git a/ssh.c b/ssh.c
index 16ef0567a2b910875e5b468a5826ad1d88aaa12b..a3255a85e5705148fcef38191246ea693c762d13 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -7093,6 +7093,15 @@ static void ssh2_msg_channel_close(Ssh ssh, struct Packet *pktin)
            break;
         }
 
+        /*
+         * Abandon any buffered data we still wanted to send to this
+         * channel. Receiving a CHANNEL_CLOSE is an indication that
+         * the server really wants to get on and _destroy_ this
+         * channel, and it isn't going to send us any further
+         * WINDOW_ADJUSTs to permit us to send pending stuff.
+         */
+        bufchain_clear(&c->v.v2.outbuffer);
+
         /*
          * Send outgoing EOF.
          */