[Spice-commits] 3 commits - server/main-channel.c server/main-channel.h server/red-channel.c server/reds.c
Jonathon Jongsma
jjongsma at kemper.freedesktop.org
Fri Apr 29 20:50:30 UTC 2016
server/main-channel.c | 16 +++++++++-------
server/main-channel.h | 15 +++++++++------
server/red-channel.c | 19 ++++++++++++-------
server/reds.c | 19 ++++++++++---------
4 files changed, 40 insertions(+), 29 deletions(-)
New commits:
commit a08bf5138383c7e364635375e8296910ba91c714
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date: Thu Feb 26 10:34:18 2015 -0600
Name MainChannelClient methods consistently
Always use main_channel_client_ prefix instead of just main_channel_ in
some cases.
diff --git a/server/main-channel.c b/server/main-channel.c
index 7d55de7..6fc21b7 100644
--- a/server/main-channel.c
+++ b/server/main-channel.c
@@ -509,10 +509,12 @@ static int main_channel_handle_migrate_data(RedChannelClient *rcc,
return reds_handle_migrate_data(rcc->channel->reds, mcc, (SpiceMigrateDataMain *)(header + 1), size);
}
-void main_channel_push_init(MainChannelClient *mcc,
- int display_channels_hint, int current_mouse_mode,
- int is_client_mouse_allowed, int multi_media_time,
- int ram_hint)
+void main_channel_client_push_init(MainChannelClient *mcc,
+ int display_channels_hint,
+ int current_mouse_mode,
+ int is_client_mouse_allowed,
+ int multi_media_time,
+ int ram_hint)
{
RedPipeItem *item;
@@ -544,7 +546,7 @@ static void main_channel_marshall_init(RedChannelClient *rcc,
spice_marshall_msg_main_init(m, &init);
}
-void main_channel_push_name(MainChannelClient *mcc, const char *name)
+void main_channel_client_push_name(MainChannelClient *mcc, const char *name)
{
RedPipeItem *item;
@@ -556,7 +558,7 @@ void main_channel_push_name(MainChannelClient *mcc, const char *name)
red_channel_client_pipe_add_push(&mcc->base, item);
}
-void main_channel_push_uuid(MainChannelClient *mcc, const uint8_t uuid[16])
+void main_channel_client_push_uuid(MainChannelClient *mcc, const uint8_t uuid[16])
{
RedPipeItem *item;
@@ -853,7 +855,7 @@ void main_channel_client_handle_migrate_end(MainChannelClient *mcc)
red_client_semi_seamless_migrate_complete(mcc->base.client);
}
-void main_channel_migrate_dst_complete(MainChannelClient *mcc)
+void main_channel_client_migrate_dst_complete(MainChannelClient *mcc)
{
if (mcc->mig_wait_prev_complete) {
if (mcc->mig_wait_prev_try_seamless) {
diff --git a/server/main-channel.h b/server/main-channel.h
index fd16c94..34e91b0 100644
--- a/server/main-channel.h
+++ b/server/main-channel.h
@@ -64,9 +64,12 @@ void main_channel_client_push_agent_data(MainChannelClient *mcc, uint8_t* data,
void main_channel_client_start_net_test(MainChannelClient *mcc, int test_rate);
// TODO: huge. Consider making a reds_* interface for these functions
// and calling from main.
-void main_channel_push_init(MainChannelClient *mcc, int display_channels_hint,
- int current_mouse_mode, int is_client_mouse_allowed, int multi_media_time,
- int ram_hint);
+void main_channel_client_push_init(MainChannelClient *mcc,
+ int display_channels_hint,
+ int current_mouse_mode,
+ int is_client_mouse_allowed,
+ int multi_media_time,
+ int ram_hint);
void main_channel_client_push_notify(MainChannelClient *mcc, const char *msg);
void main_channel_push_multi_media_time(MainChannel *main_chan, int time);
int main_channel_getsockname(MainChannel *main_chan, struct sockaddr *sa, socklen_t *salen);
@@ -96,8 +99,8 @@ int main_channel_migrate_connect(MainChannel *main_channel, RedsMigSpice *mig_ta
void main_channel_migrate_cancel_wait(MainChannel *main_chan);
/* returns the number of clients for which SPICE_MSG_MAIN_MIGRATE_END was sent*/
int main_channel_migrate_src_complete(MainChannel *main_chan, int success);
-void main_channel_migrate_dst_complete(MainChannelClient *mcc);
-void main_channel_push_name(MainChannelClient *mcc, const char *name);
-void main_channel_push_uuid(MainChannelClient *mcc, const uint8_t uuid[16]);
+void main_channel_client_migrate_dst_complete(MainChannelClient *mcc);
+void main_channel_client_push_name(MainChannelClient *mcc, const char *name);
+void main_channel_client_push_uuid(MainChannelClient *mcc, const uint8_t uuid[16]);
#endif
diff --git a/server/reds.c b/server/reds.c
index 08f827c..efd1429 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -1825,14 +1825,14 @@ static void reds_handle_main_link(RedsState *reds, RedLinkInfo *link)
}
if (!mig_target) {
- main_channel_push_init(mcc, g_list_length(reds->qxl_instances),
+ main_channel_client_push_init(mcc, g_list_length(reds->qxl_instances),
reds->mouse_mode, reds->is_client_mouse_allowed,
reds_get_mm_time() - MM_TIME_DELTA,
reds_qxl_ram_size(reds));
if (reds->config->spice_name)
- main_channel_push_name(mcc, reds->config->spice_name);
+ main_channel_client_push_name(mcc, reds->config->spice_name);
if (reds->config->spice_uuid_is_set)
- main_channel_push_uuid(mcc, reds->config->spice_uuid);
+ main_channel_client_push_uuid(mcc, reds->config->spice_uuid);
} else {
reds_mig_target_client_add(reds, client);
}
@@ -1960,7 +1960,7 @@ void reds_on_client_seamless_migrate_complete(RedsState *reds, RedClient *client
spice_info("client no longer exists");
return;
}
- main_channel_migrate_dst_complete(red_client_get_main(client));
+ main_channel_client_migrate_dst_complete(red_client_get_main(client));
}
void reds_on_client_semi_seamless_migrate_complete(RedsState *reds, RedClient *client)
@@ -1971,12 +1971,13 @@ void reds_on_client_semi_seamless_migrate_complete(RedsState *reds, RedClient *c
mcc = red_client_get_main(client);
// TODO: not doing net test. consider doing it on client_migrate_info
- main_channel_push_init(mcc, g_list_length(reds->qxl_instances),
- reds->mouse_mode, reds->is_client_mouse_allowed,
- reds_get_mm_time() - MM_TIME_DELTA,
- reds_qxl_ram_size(reds));
+ main_channel_client_push_init(mcc, g_list_length(reds->qxl_instances),
+ reds->mouse_mode,
+ reds->is_client_mouse_allowed,
+ reds_get_mm_time() - MM_TIME_DELTA,
+ reds_qxl_ram_size(reds));
reds_link_mig_target_channels(reds, client);
- main_channel_migrate_dst_complete(mcc);
+ main_channel_client_migrate_dst_complete(mcc);
}
static void reds_handle_other_links(RedsState *reds, RedLinkInfo *link)
commit 88d76a9faa5b1e50927700adc7b487e62f02f49c
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date: Wed Feb 25 12:13:17 2015 -0600
Call public RedClient API instead of poking internals
Use red_client_during_migrate_at_target() instead of checking
rcc->client->during_target_migrate.
diff --git a/server/red-channel.c b/server/red-channel.c
index fbe00fc..cdd1cf0 100644
--- a/server/red-channel.c
+++ b/server/red-channel.c
@@ -839,7 +839,7 @@ void red_channel_client_start_connectivity_monitoring(RedChannelClient *rcc, uin
if (rcc->latency_monitor.timer == NULL) {
rcc->latency_monitor.timer = rcc->channel->core->timer_add(
rcc->channel->core, red_channel_client_ping_timer, rcc);
- if (!rcc->client->during_target_migrate) {
+ if (!red_client_during_migrate_at_target(rcc->client)) {
red_channel_client_start_ping_timer(rcc, PING_TEST_IDLE_NET_TIMEOUT_MS);
}
rcc->latency_monitor.roundtrip = -1;
@@ -849,7 +849,7 @@ void red_channel_client_start_connectivity_monitoring(RedChannelClient *rcc, uin
rcc->connectivity_monitor.timer = rcc->channel->core->timer_add(
rcc->channel->core, red_channel_client_connectivity_timer, rcc);
rcc->connectivity_monitor.timeout = timeout_ms;
- if (!rcc->client->during_target_migrate) {
+ if (!red_client_during_migrate_at_target(rcc->client)) {
rcc->channel->core->timer_start(rcc->connectivity_monitor.timer,
rcc->connectivity_monitor.timeout);
}
commit f38cddfacf5eec1856043c7da7ac42176f679a28
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date: Wed Feb 25 11:51:50 2015 -0600
Don't touch RedClient internals from RedChannelClient
Change red_channel_client_set_migration_seamless() so that it returns a
boolean which RedClient can use to update its internal count of
num_migrated_channels rather than having RedChannelClient reaching into
the internals of RedClient
diff --git a/server/red-channel.c b/server/red-channel.c
index d9aab01..fbe00fc 100644
--- a/server/red-channel.c
+++ b/server/red-channel.c
@@ -2075,28 +2075,32 @@ RedClient *red_client_unref(RedClient *client)
}
/* client mutex should be locked before this call */
-static void red_channel_client_set_migration_seamless(RedChannelClient *rcc)
+static gboolean red_channel_client_set_migration_seamless(RedChannelClient *rcc)
{
- spice_assert(rcc->client->during_target_migrate && rcc->client->seamless_migrate);
+ gboolean ret = FALSE;
if (rcc->channel->migration_flags & SPICE_MIGRATE_NEED_DATA_TRANSFER) {
rcc->wait_migrate_data = TRUE;
- rcc->client->num_migrated_channels++;
+ ret = TRUE;
}
spice_debug("channel type %d id %d rcc %p wait data %d", rcc->channel->type, rcc->channel->id, rcc,
rcc->wait_migrate_data);
+
+ return ret;
}
void red_client_set_migration_seamless(RedClient *client) // dest
{
RingItem *link;
+ spice_assert(client->during_target_migrate);
pthread_mutex_lock(&client->lock);
client->seamless_migrate = TRUE;
/* update channel clients that got connected before the migration
* type was set. red_client_add_channel will handle newer channel clients */
RING_FOREACH(link, &client->channels) {
RedChannelClient *rcc = SPICE_CONTAINEROF(link, RedChannelClient, client_link);
- red_channel_client_set_migration_seamless(rcc);
+ if (red_channel_client_set_migration_seamless(rcc))
+ client->num_migrated_channels++;
}
pthread_mutex_unlock(&client->lock);
}
@@ -2176,7 +2180,8 @@ static void red_client_add_channel(RedClient *client, RedChannelClient *rcc)
spice_assert(rcc && client);
ring_add(&client->channels, &rcc->client_link);
if (client->during_target_migrate && client->seamless_migrate) {
- red_channel_client_set_migration_seamless(rcc);
+ if (red_channel_client_set_migration_seamless(rcc))
+ client->num_migrated_channels++;
}
client->channels_num++;
}
More information about the Spice-commits
mailing list