summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2010-11-09 11:30:39 +0200
committerAlon Levy <alevy@redhat.com>2011-03-02 17:27:51 +0200
commit17b6a58f1eb27f5042a02eb690e127ee58987c25 (patch)
treecb4fea853192a5928a13c93152841ff8719ea241 /server
parentcd99a0b4b36ce4ff3962df085189a585301e212d (diff)
downloadspice-17b6a58f1eb27f5042a02eb690e127ee58987c25.tar.gz
spice-17b6a58f1eb27f5042a02eb690e127ee58987c25.tar.xz
spice-17b6a58f1eb27f5042a02eb690e127ee58987c25.zip
server/red_channel (all): makes red_channel_reset_send_data private
ready the way for handling ack messages in RedChannel.
Diffstat (limited to 'server')
-rw-r--r--server/inputs_channel.c1
-rw-r--r--server/main_channel.c1
-rw-r--r--server/red_channel.c49
-rw-r--r--server/red_channel.h3
-rw-r--r--server/red_tunnel_worker.c1
-rw-r--r--server/red_worker.c2
-rw-r--r--server/smartcard.c1
7 files changed, 34 insertions, 24 deletions
diff --git a/server/inputs_channel.c b/server/inputs_channel.c
index ce532caf..9dedc930 100644
--- a/server/inputs_channel.c
+++ b/server/inputs_channel.c
@@ -257,7 +257,6 @@ static void inputs_channel_send_item(RedChannel *channel, PipeItem *base)
InputsChannel *inputs_channel = (InputsChannel *)channel;
SpiceMarshaller *m = inputs_channel->base.send_data.marshaller;
- red_channel_reset_send_data(channel);
red_channel_init_send_data(channel, base->type, base);
switch (base->type) {
case PIPE_ITEM_KEY_MODIFIERS:
diff --git a/server/main_channel.c b/server/main_channel.c
index 64048daa..ca77b98f 100644
--- a/server/main_channel.c
+++ b/server/main_channel.c
@@ -591,7 +591,6 @@ static void main_channel_send_item(RedChannel *channel, PipeItem *base)
{
MainChannel *main_chan = SPICE_CONTAINEROF(channel, MainChannel, base);
- red_channel_reset_send_data(channel);
red_channel_init_send_data(channel, base->type, base);
switch (base->type) {
case SPICE_MSG_MAIN_CHANNELS_LIST:
diff --git a/server/red_channel.c b/server/red_channel.c
index 7bc1b688..4492cfb5 100644
--- a/server/red_channel.c
+++ b/server/red_channel.c
@@ -241,12 +241,41 @@ static void red_channel_peer_on_out_block(void *opaque)
SPICE_WATCH_EVENT_WRITE);
}
+static void red_channel_reset_send_data(RedChannel *channel)
+{
+ spice_marshaller_reset(channel->send_data.marshaller);
+ channel->send_data.header = (SpiceDataHeader *)
+ spice_marshaller_reserve_space(channel->send_data.marshaller, sizeof(SpiceDataHeader));
+ spice_marshaller_set_base(channel->send_data.marshaller, sizeof(SpiceDataHeader));
+ channel->send_data.header->type = 0;
+ channel->send_data.header->size = 0;
+ channel->send_data.header->sub_list = 0;
+ channel->send_data.header->serial = ++channel->send_data.serial;
+}
+
+static void red_channel_send_item(RedChannel *channel, PipeItem *item)
+{
+ red_channel_reset_send_data(channel);
+ switch (item->type) {
+ }
+ /* only reached if not handled here */
+ channel->send_item(channel, item);
+}
+
+static void red_channel_release_item(RedChannel *channel, PipeItem *item, int item_pushed)
+{
+ switch (item->type) {
+ }
+ /* only reached if not handled here */
+ channel->release_item(channel, item, item_pushed);
+}
+
static void red_channel_peer_on_out_msg_done(void *opaque)
{
RedChannel *channel = (RedChannel *)opaque;
channel->send_data.size = 0;
if (channel->send_data.item) {
- channel->release_item(channel, channel->send_data.item, TRUE);
+ red_channel_release_item(channel, channel->send_data.item, TRUE);
channel->send_data.item = NULL;
}
if (channel->send_data.blocked) {
@@ -447,18 +476,6 @@ void red_channel_add_buf(RedChannel *channel, void *data, uint32_t size)
channel->send_data.header->size += size;
}
-void red_channel_reset_send_data(RedChannel *channel)
-{
- spice_marshaller_reset(channel->send_data.marshaller);
- channel->send_data.header = (SpiceDataHeader *)
- spice_marshaller_reserve_space(channel->send_data.marshaller, sizeof(SpiceDataHeader));
- spice_marshaller_set_base(channel->send_data.marshaller, sizeof(SpiceDataHeader));
- channel->send_data.header->type = 0;
- channel->send_data.header->size = 0;
- channel->send_data.header->sub_list = 0;
- channel->send_data.header->serial = ++channel->send_data.serial;
-}
-
void red_channel_init_send_data(RedChannel *channel, uint16_t msg_type, PipeItem *item)
{
ASSERT(channel->send_data.item == NULL);
@@ -503,7 +520,7 @@ void red_channel_push(RedChannel *channel)
}
while ((pipe_item = red_channel_pipe_get(channel))) {
- channel->send_item(channel, pipe_item);
+ red_channel_send_item(channel, pipe_item);
}
channel->during_send = FALSE;
}
@@ -609,11 +626,11 @@ void red_channel_pipe_clear(RedChannel *channel)
ASSERT(channel);
if (channel->send_data.item) {
- channel->release_item(channel, channel->send_data.item, TRUE);
+ red_channel_release_item(channel, channel->send_data.item, TRUE);
}
while ((item = (PipeItem *)ring_get_head(&channel->pipe))) {
ring_remove(&item->link);
- channel->release_item(channel, item, FALSE);
+ red_channel_release_item(channel, item, FALSE);
}
channel->pipe_size = 0;
}
diff --git a/server/red_channel.h b/server/red_channel.h
index fb5af99c..9563c0e2 100644
--- a/server/red_channel.h
+++ b/server/red_channel.h
@@ -203,9 +203,8 @@ int red_channel_handle_message(RedChannel *channel, uint32_t size,
/* default error handler that disconnects channel */
void red_channel_default_peer_on_error(RedChannel *channel);
-/* when preparing send_data: should call reset, then init and then add_buf per buffer that is
+/* when preparing send_data: should call init and then add_buf per buffer that is
being sent */
-void red_channel_reset_send_data(RedChannel *channel);
void red_channel_init_send_data(RedChannel *channel, uint16_t msg_type, PipeItem *item);
void red_channel_add_buf(RedChannel *channel, void *data, uint32_t size);
diff --git a/server/red_tunnel_worker.c b/server/red_tunnel_worker.c
index 2e6a336d..054a8eb6 100644
--- a/server/red_tunnel_worker.c
+++ b/server/red_tunnel_worker.c
@@ -2812,7 +2812,6 @@ static void tunnel_channel_send_item(RedChannel *channel, PipeItem *item)
{
TunnelChannel *tunnel_channel = (TunnelChannel *)channel;
- red_channel_reset_send_data(channel);
switch (item->type) {
case PIPE_ITEM_TYPE_SET_ACK:
tunnel_channel_send_set_ack(tunnel_channel, item);
diff --git a/server/red_worker.c b/server/red_worker.c
index aeaaa8b1..ed15eda0 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -5928,7 +5928,6 @@ static void fill_cursor(CursorChannel *cursor_channel, SpiceCursor *red_cursor,
static inline void red_display_reset_send_data(DisplayChannel *channel)
{
- red_channel_reset_send_data((RedChannel *)channel);
red_display_reset_compress_buf(channel);
channel->send_data.free_list.res->count = 0;
memset(channel->send_data.free_list.sync, 0, sizeof(channel->send_data.free_list.sync));
@@ -8182,7 +8181,6 @@ static void cursor_channel_send_item(RedChannel *channel, PipeItem *pipe_item)
CursorChannel *cursor_channel = SPICE_CONTAINEROF(channel, CursorChannel, common.base);
red_ref_channel(channel);
- red_channel_reset_send_data(channel);
switch (pipe_item->type) {
case PIPE_ITEM_TYPE_CURSOR:
red_send_cursor(cursor_channel, (CursorItem *)pipe_item);
diff --git a/server/smartcard.c b/server/smartcard.c
index 6afa7cd2..3675cc1a 100644
--- a/server/smartcard.c
+++ b/server/smartcard.c
@@ -309,7 +309,6 @@ static void smartcard_channel_send_item(RedChannel *channel, PipeItem *item)
{
SmartCardChannel *smartcard_channel = (SmartCardChannel *)channel;
- red_channel_reset_send_data(channel);
switch (item->type) {
case PIPE_ITEM_TYPE_ERROR:
smartcard_channel_send_error(smartcard_channel, item);