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

* src/channel.c (init_channel): Init pending_requests queue.

Deleted channel_success and channel_failure.
(do_channel_success): Use pending_requests queue rather than
channel_success and channel_failure.
(do_channel_failure): Likewise.

* src/channel.h (ssh_channel): New attribute pending_requests
(a queue). Removed methods channel_success and channel_failure.

Rev: src/channel.c:1.34
Rev: src/channel.h:1.30
parent 325a79d9
......@@ -980,18 +980,20 @@ static int do_channel_success(struct packet_handler *closure UNUSED,
&& parse_uint32(&buffer, &channel_number)
&& parse_eod(&buffer)
&& (channel = lookup_channel(connection->channels, channel_number)))
{
lsh_string_free(packet);
if (!channel->channel_failure)
if (object_queue_is_empty(&channel->pending_requests))
{
werror("do_channel_success: No handler. Ignoring.\n");
werror("do_channel_success: Unexpected message. Ignoring.\n");
return LSH_OK | LSH_GOON;
}
return channel_process_status(connection->channels, channel_number,
CHANNEL_SUCCESS(channel));
{
CAST(command_continuation, c,
object_queue_remove_head(&channel->pending_requests));
return channel_process_status(connection->channels, channel_number,
COMMAND_RETURN(c, channel));
}
}
lsh_string_free(packet);
return LSH_FAIL | LSH_DIE;
......@@ -1016,14 +1018,18 @@ static int do_channel_failure(struct packet_handler *closure UNUSED,
{
lsh_string_free(packet);
if (!channel->channel_failure)
if (object_queue_is_empty(&channel->pending_requests))
{
werror("do_channel_failure: No handler. Ignoring.\n");
return LSH_OK | LSH_GOON;
}
return channel_process_status(connection->channels, channel_number,
CHANNEL_FAILURE(channel));
{
CAST(command_continuation, c,
object_queue_remove_head(&channel->pending_requests));
return channel_process_status(connection->channels, channel_number,
COMMAND_RETURN(c, NULL));
}
}
lsh_string_free(packet);
return LSH_FAIL | LSH_DIE;
......@@ -1175,8 +1181,13 @@ void init_channel(struct ssh_channel *channel)
channel->eof = NULL;
channel->open_continuation = NULL;
object_queue_init(&channel->pending_requests);
#if 0
channel->channel_success = NULL;
channel->channel_failure = NULL;
#endif
}
struct lsh_string *channel_transmit_data(struct ssh_channel *channel,
......
......@@ -53,6 +53,7 @@
/* Means that we should send close when we have both sent and received EOF. */
#define CHANNEL_CLOSE_AT_EOF 0x10
/* GABA:
(class
(name ssh_channel)
......@@ -60,7 +61,7 @@
; Remote channel number
(channel_number simple UINT32)
; We try to keep the rec_window_size ; between max_window / 2
; We try to keep the rec_window_size between max_window / 2
; and max_window.
(max_window simple UINT32)
......@@ -110,9 +111,13 @@
;; (open_failure method int)
(open_continuation object command_continuation)
;; Queue of channel requests that we expect replies on
(pending_requests struct object_queue)))
; Reply from SSH_MSG_CHANNEL_REQUEST
(channel_success method int)
(channel_failure method int))) */
;; (channel_success method int)
;; (channel_failure method int)))
*/
#define CHANNEL_RECEIVE(s, t, d) \
((s)->receive((s), (t), (d)))
......@@ -131,11 +136,13 @@
#define CHANNEL_OPEN_FAILURE(s) \
((s)->open_failure((s)))
#if 0
#define CHANNEL_SUCCESS(s) \
((s)->channel_success((s)))
#define CHANNEL_FAILURE(s) \
((s)->channel_failure((s)))
#endif
/* FIXME: Perhaps, this information is better kept in the connection
* object? */
......
Supports Markdown
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