[Spice-devel] [PATCH v2 35/40] server/red_channel: add red_channel_disconnect, use in red_worker
Alon Levy
alevy at redhat.com
Wed Mar 2 00:31:58 PST 2011
replace channel_release_res in red_worker with red_channel_disconnect.
---
server/red_channel.c | 9 +++++++++
server/red_channel.h | 2 ++
server/red_worker.c | 16 +---------------
3 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/server/red_channel.c b/server/red_channel.c
index 4330236..18c7f35 100644
--- a/server/red_channel.c
+++ b/server/red_channel.c
@@ -751,3 +751,12 @@ int red_channel_no_item_being_sent(RedChannel *channel)
{
return channel->send_data.item == NULL;
}
+
+void red_channel_disconnect(RedChannel *channel)
+{
+ red_channel_pipe_clear(channel);
+ reds_stream_free(channel->stream);
+ channel->stream = NULL;
+ channel->send_data.blocked = FALSE;
+ channel->send_data.size = 0;
+}
diff --git a/server/red_channel.h b/server/red_channel.h
index d08b661..15c3b3c 100644
--- a/server/red_channel.h
+++ b/server/red_channel.h
@@ -286,6 +286,8 @@ void red_channel_pipe_clear(RedChannel *channel);
// handle_channel_events - this is the only one that was used before, and was in red_channel.c
void red_channel_receive(RedChannel *channel);
void red_channel_send(RedChannel *channel);
+// For red_worker
+void red_channel_disconnect(RedChannel *channel);
/* accessors for RedChannel */
/* Note: the valid times to call red_channel_get_marshaller are just during send_item callback. */
diff --git a/server/red_worker.c b/server/red_worker.c
index d9b7032..14e8fef 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -7182,15 +7182,6 @@ static inline void red_marshall_qxl_drawable(RedWorker *worker, DisplayChannel *
}
}
-static void inline channel_release_res(RedChannel *channel)
-{
- if (!channel->send_data.item) {
- return;
- }
- channel->release_item(channel, channel->send_data.item, FALSE);
- channel->send_data.item = NULL;
-}
-
static void display_channel_push_release(DisplayChannel *channel, uint8_t type, uint64_t id,
uint64_t* sync_data)
{
@@ -8268,12 +8259,7 @@ void red_show_tree(RedWorker *worker)
// TODO: move to red_channel
static void red_disconnect_channel(RedChannel *channel)
{
- channel_release_res(channel);
- red_channel_pipe_clear(channel);
- reds_stream_free(channel->stream);
- channel->stream = NULL;
- channel->send_data.blocked = FALSE;
- channel->send_data.size = 0;
+ red_channel_disconnect(channel);
red_unref_channel(channel);
}
--
1.7.4.1
More information about the Spice-devel
mailing list