1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-25 01:02:24 +00:00

Another tweak to EOF policy: invent an outgoing EOF on receipt of an

incoming CHANNEL_CLOSE, if it's the main session channel. The idea is
that invocations such as 'plink -T hostname sh' (running a shell
without a remote pty) can be exited by typing 'exit' to the remote
shell, without plink blocking forever waiting for outgoing EOF.

I think it would be better to do the same for all other channel types
too, but that would need an extra API call which I haven't
implemented yet.

[originally from svn r9283]
This commit is contained in:
Simon Tatham 2011-09-14 09:09:35 +00:00
parent 6e2bcd24a4
commit c54e228d04

18
ssh.c
View File

@ -6977,6 +6977,24 @@ static void ssh2_msg_channel_close(Ssh ssh, struct Packet *pktin)
*/
ssh2_channel_got_eof(c);
/*
* And we also send an outgoing EOF, if we haven't already, on the
* assumption that CLOSE is a pretty forceful announcement that
* 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)) {
sshfwd_write_eof(ssh->mainchan);
ssh->send_ok = 0; /* now stop trying to read from stdin */
}
/*
* Now process the actual close.
*/