Commit ff2758b0 authored by Niels Möller's avatar Niels Möller
Browse files

* src/channel.c (channel_read_close_callback): Call channel_eof, not

channel_close.
(channel_eof_handler): Moved the channel close decision here.

Rev: src/channel.c:1.91
parent 35938fd6
...@@ -1385,13 +1385,21 @@ DEFINE_PACKET_HANDLER(static, channel_eof_handler, ...@@ -1385,13 +1385,21 @@ DEFINE_PACKET_HANDLER(static, channel_eof_handler,
channel->flags |= CHANNEL_RECEIVED_EOF; channel->flags |= CHANNEL_RECEIVED_EOF;
if (channel->eof) if (channel->eof)
CHANNEL_EOF(channel); {
CHANNEL_EOF(channel);
/* Should we close the channel now? */
if ( (channel->flags & CHANNEL_SENT_EOF)
&& (channel->flags & CHANNEL_CLOSE_AT_EOF))
channel_close(channel);
}
else else
{ {
/* By default, close the channel. */ /* By default, close the channel. */
debug("No CHANNEL_EOF handler. Closing.\n"); debug("No CHANNEL_EOF handler. Closing.\n");
channel_close(channel); channel_close(channel);
} }
} }
} }
else else
...@@ -1954,6 +1962,17 @@ make_channel_read_stderr(struct ssh_channel *channel) ...@@ -1954,6 +1962,17 @@ make_channel_read_stderr(struct ssh_channel *channel)
(vars (vars
(channel object ssh_channel))) */ (channel object ssh_channel))) */
/* FIXME: Do we really need this? The EOF cases in do_channel_write
* and do_channel_write_extended should take care of sending
* SSH_MSG_CHANNEL_EOF when appropriate (and they could also decrement
* the sources counter, even if they don't do that now).
*
* Then the ordinary close logic could take care of sending
* SSH_MSG_CHANNEL_CLOSE: We send SSH_MSG_CHANNEL_CLOSE when we have
* both sent and received SSH_MSG_CHANNEL_EOF, and the
* CHANNEL_CLOSE_AT_EOF flag is set. */
/* Close callback for files we are reading from. */ /* Close callback for files we are reading from. */
static void static void
...@@ -1967,8 +1986,8 @@ channel_read_close_callback(struct lsh_callback *c) ...@@ -1967,8 +1986,8 @@ channel_read_close_callback(struct lsh_callback *c)
if (!--closure->channel->sources) if (!--closure->channel->sources)
{ {
/* Send close, unless already done. */ /* Send eof, unless already done. */
channel_close(closure->channel); channel_eof(closure->channel);
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment