summaryrefslogtreecommitdiffstats
path: root/server/red_channel.c
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2011-08-22 15:36:56 +0100
committerAlon Levy <alevy@redhat.com>2011-08-23 18:28:59 +0300
commit9255515c15e4c322c35395b31e056a807b389289 (patch)
treebaec5606e52ef853c974d07af04f6cd96bc6008c /server/red_channel.c
parent439993d7882bc5a9b1055553f30b8b18140b7f0d (diff)
downloadspice-9255515c15e4c322c35395b31e056a807b389289.tar.gz
spice-9255515c15e4c322c35395b31e056a807b389289.tar.xz
spice-9255515c15e4c322c35395b31e056a807b389289.zip
server/snd_worker.c: add red_channel_client_destroy_dummy
Diffstat (limited to 'server/red_channel.c')
-rw-r--r--server/red_channel.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/server/red_channel.c b/server/red_channel.c
index 3f47f7f7..87320b47 100644
--- a/server/red_channel.c
+++ b/server/red_channel.c
@@ -403,21 +403,6 @@ error:
return NULL;
}
-
-RedChannelClient *red_channel_client_create_dummy(int size,
- RedChannel *channel,
- RedClient *client)
-{
- RedChannelClient *rcc;
-
- ASSERT(size >= sizeof(RedChannelClient));
- rcc = spice_malloc0(size);
- rcc->client = client;
- rcc->channel = channel;
- red_channel_add_client(channel, rcc);
- return rcc;
-}
-
static void red_channel_client_default_connect(RedChannel *channel, RedClient *client,
RedsStream *stream,
int migration,
@@ -951,6 +936,7 @@ static void red_channel_remove_client(RedChannelClient *rcc)
{
ASSERT(pthread_equal(pthread_self(), rcc->channel->thread_id));
ring_remove(&rcc->channel_link);
+ ASSERT(rcc->channel->clients_num > 0);
rcc->channel->clients_num--;
// TODO: should we set rcc->channel to NULL???
}
@@ -990,6 +976,26 @@ void red_channel_disconnect(RedChannel *channel)
}
}
+RedChannelClient *red_channel_client_create_dummy(int size,
+ RedChannel *channel,
+ RedClient *client)
+{
+ RedChannelClient *rcc;
+
+ ASSERT(size >= sizeof(RedChannelClient));
+ rcc = spice_malloc0(size);
+ rcc->client = client;
+ rcc->channel = channel;
+ red_channel_add_client(channel, rcc);
+ return rcc;
+}
+
+void red_channel_client_destroy_dummy(RedChannelClient *rcc)
+{
+ red_channel_remove_client(rcc);
+ free(rcc);
+}
+
void red_channel_apply_clients(RedChannel *channel, channel_client_callback cb)
{
RingItem *link;