]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
No, I take that back: we _do_ have a mechanism for suppressing reads
authorSimon Tatham <anakin@pobox.com>
Wed, 14 Sep 2011 09:49:00 +0000 (09:49 +0000)
committerSimon Tatham <anakin@pobox.com>
Wed, 14 Sep 2011 09:49:00 +0000 (09:49 +0000)
from forwarding data sources which will be good enough to last until
we close the socket, in the form of the override_throttle() functions.
So this finishes up the work in r9283, by manufacturing outgoing EOF
in response to incoming CLOSE on all channel types.

[originally from svn r9284]
[r9283 == c54e228d0497409d72f336ea43f821b736a5ab29]

ssh.c

diff --git a/ssh.c b/ssh.c
index eee792b77c18ab73e291c692955b4e2175151729..7deb90c0f907d24251785629b0d8000b7f88c1bb 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -6983,16 +6983,28 @@ static void ssh2_msg_channel_close(Ssh ssh, struct Packet *pktin)
      * the remote side is doing away with the entire channel. (If it
      * had wanted to send us EOF and continue receiving data from us,
      * it would have just sent CHANNEL_EOF.)
-     *
-     * For the moment, this policy applies to the main session channel
-     * only, because we have a convenient mechanism (ssh->send_ok) for
-     * ceasing to read from our local data source. Ideally I think
-     * we'd do this for auxiliary channels too, which would need an
-     * extra API call in the forwarding modules.
      */
-    if (c->type == CHAN_MAINSESSION && !(c->closes & CLOSES_SENT_EOF)) {
+    if (!(c->closes & CLOSES_SENT_EOF)) {
+        /*
+         * Make sure we don't read any more from whatever our local
+         * data source is for this channel.
+         */
+        switch (c->type) {
+          case CHAN_MAINSESSION:
+            ssh->send_ok = 0;     /* stop trying to read from stdin */
+            break;
+          case CHAN_X11:
+           x11_override_throttle(c->u.x11.s, 1);
+           break;
+         case CHAN_SOCKDATA:
+           pfd_override_throttle(c->u.pfd.s, 1);
+           break;
+        }
+
+        /*
+         * Send outgoing EOF.
+         */
         sshfwd_write_eof(ssh->mainchan);
-        ssh->send_ok = 0;          /* now stop trying to read from stdin */
     }
 
     /*