If the SSH server sends us CHANNEL_CLOSE for a channel on which we're
[sgt/putty] / ssh.c
diff --git a/ssh.c b/ssh.c
index 16ef056..a3255a8 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -7094,6 +7094,15 @@ static void ssh2_msg_channel_close(Ssh ssh, struct Packet *pktin)
         }
 
         /*
+         * 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.
          */
         sshfwd_write_eof(c);