IETF-SSH archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: closing a channel
Markus Friedl <markus%openbsd.org@localhost> writes:
> Hi, is it allowed to send an EXTENDED data message
> after sending an EOF message? Is extended data
> considered channel data?
I'd say extended data count as data. Sending EOF means that you won't
send either ordinary data or extended data anymore. (On the server
side, I have a counter on the session channel. When I get EOF on the
process' stdout or stderr, I decrement the counter. When it reaches
zero, I send EOF on the channel).
My reasons for this:
Ordinary data and extended data are treated as a single stream for
flow control. It would be odd to treat them differently with respect
to EOF only.
Allowing extended data after EOF means that there's no way to indicate
EOF on the extended data channel; the other end can never know that it
shouldn't expect more data. That's bad. Consider a client that wants
to wait until the server will send no more data of any kind, and then
send some final CHANNEL_REQUESTs before closing the channel.
It might be desirable to have a wider separation between stdout and
stderr data than is provided by the extended data hack. But if we want
that, the Right Way is create a separate channel for stderr, with
independent flow control and working EOF indication. One should invent
a message
byte CHANNEL_OPEN
string "session-stderr"
uint32 channel ; The session we want to attach this channel to
or something like that.
My answers to some of the other questions raised in this thread:
Can one send CHANNEL_REQUEST after EOF? I'd say yes. In particular,
the order in which my server sends CHANNEL_EOF and CHANNEL_REQUEST
"exit-status" depends on the the relative timing of i/o and the
SIGCHLD signal, and is esssentially random.
Can one send WINDOW_ADJUST after EOF? This is an ill-posed question.
The EOF message I send and the WINDOW_ADJUST messages I send affects
different directions of the channel, and they are therefore
independent. I can send EOF as soon as the channel is created, and
then go on sending lots of WINDOW_ADJUST messages while I download a
GB or two of data.
Can I send WINDOW_ADJUST after I *received* EOF? Yes, the other
end can't know the exact sequence of events anyway. And turning it
around, what should I do if I *receive* WINDOW_ADJUST after I *sent*
EOF? I'd say such messages should be silently ignored; the other end
may well have sent the WINDOW_ADJUST before seeing my EOF.
Best regards,
/Niels
Home |
Main Index |
Thread Index |
Old Index