summaryrefslogtreecommitdiffstats
path: root/server/red_channel.h
diff options
context:
space:
mode:
authorYonit Halperin <yhalperi@redhat.com>2011-12-28 13:31:20 +0200
committerYonit Halperin <yhalperi@redhat.com>2012-01-12 16:17:00 +0200
commitb689abe576c382ab1107e50f7b24de116a622dab (patch)
tree42d7f55196e686170d08af6d923c205724fe7108 /server/red_channel.h
parent33feaf75d67584beae7c548b948dbb34b7cf6171 (diff)
downloadspice-b689abe576c382ab1107e50f7b24de116a622dab.tar.gz
spice-b689abe576c382ab1107e50f7b24de116a622dab.tar.xz
spice-b689abe576c382ab1107e50f7b24de116a622dab.zip
server/red_channel: introduce urgent marshaller
When red_channel::red_channel_client_begin_send_message is called, the message that is pending in the urgent marshaller will be sent before the one in the main channel. The urgent marshaller should be used if in the middle of marshalling one message, you find out you need to send another message before. This functionality is equivalent to the sub_list messages. It will replace them in the following patches, when sub_list is removed from Spice data header.
Diffstat (limited to 'server/red_channel.h')
-rw-r--r--server/red_channel.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/server/red_channel.h b/server/red_channel.h
index cce69658..cb80100e 100644
--- a/server/red_channel.h
+++ b/server/red_channel.h
@@ -207,6 +207,17 @@ struct RedChannelClient {
PipeItem *item;
int blocked;
uint64_t serial;
+
+ struct {
+ SpiceMarshaller *marshaller;
+ SpiceDataHeader *header;
+ PipeItem *item;
+ } main;
+
+ struct {
+ SpiceMarshaller *marshaller;
+ SpiceDataHeader *header;
+ } urgent;
} send_data;
OutgoingHandler outgoing;
@@ -331,9 +342,23 @@ void red_channel_client_init_send_data(RedChannelClient *rcc, uint16_t msg_type,
uint64_t red_channel_client_get_message_serial(RedChannelClient *channel);
void red_channel_client_set_message_serial(RedChannelClient *channel, uint64_t);
-/* when sending a msg. should first call red_channel_client_begin_send_message */
+/* When sending a msg. Should first call red_channel_client_begin_send_message.
+ * It will first send the pending urgent data, if there is any, and then
+ * the rest of the data.
+ */
void red_channel_client_begin_send_message(RedChannelClient *rcc);
+/*
+ * Stores the current send data, and switches to urgent send data.
+ * When it begins the actual send, it will send first the urgent data
+ * and afterward the rest of the data.
+ * Should be called only if during the marshalling of on message,
+ * the need to send another message, before, rises.
+ * Important: the serial of the non-urgent sent data, will be succeeded.
+ * return: the urgent send data marshaller
+ */
+SpiceMarshaller *red_channel_client_switch_to_urgent_sender(RedChannelClient *rcc);
+
void red_channel_pipe_item_init(RedChannel *channel, PipeItem *item, int type);
// TODO: add back the channel_pipe_add functionality - by adding reference counting