Differences From Artifact [aa8bf10a74]:
- File ssh.c — part of check-in [3aaf9b7e0f] at 2011-09-13 10:38:12 on branch trunk — Changed my mind about the EOF policy in SSH mode: I think the SSH backend should unilaterally assume outgoing EOF when it sees incoming EOF, if and only if the main session channel is talking to a pty. (Because ptys don't have a strong concept of EOF in the first place, that seems like a sensible place to draw the line.) This fixes a bug introduced by today's revamp in which if you used Unix Plink to run a console session it would hang after you hit ^D - because the server had sent EOF, but it was waiting for a client-side EOF too. (user: simon size: 306705)
To Artifact [754c4c9994]:
- File ssh.c — part of check-in [304b3571f2] at 2011-09-14 04:09:35 on branch trunk — 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. (user: simon size: 307573)
| ︙ | |||
6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 | 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 | + + + + + + + + + + + + + + + + + + |
return;
/*
* When we receive CLOSE on a channel, we assume it comes with an
* implied EOF if we haven't seen EOF yet.
*/
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.
*/
if (!(c->closes & CLOSES_RCVD_CLOSE)) {
c->closes |= CLOSES_RCVD_CLOSE;
ssh2_channel_check_close(c);
|
| ︙ |