mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2025-12-26 22:48:19 +00:00
red-client: Automatically set MainChannelClient
This make sure that the RedClient has always an attached MainChannelClient. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
parent
59be4f19c4
commit
5f02dff835
@ -295,6 +295,11 @@ gboolean red_client_add_channel(RedClient *client, RedChannelClient *rcc, GError
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
// first must be the main one
|
||||
if (!client->mcc) {
|
||||
client->mcc = g_object_ref(rcc);
|
||||
spice_assert(MAIN_CHANNEL_CLIENT(rcc) != NULL);
|
||||
}
|
||||
client->channels = g_list_prepend(client->channels, rcc);
|
||||
if (client->during_target_migrate && client->seamless_migrate) {
|
||||
if (red_channel_client_set_migration_seamless(rcc)) {
|
||||
@ -312,12 +317,6 @@ MainChannelClient *red_client_get_main(RedClient *client)
|
||||
return client->mcc;
|
||||
}
|
||||
|
||||
void red_client_set_main(RedClient *client, MainChannelClient *mcc)
|
||||
{
|
||||
spice_assert(client->mcc == NULL);
|
||||
client->mcc = g_object_ref(mcc);
|
||||
}
|
||||
|
||||
void red_client_semi_seamless_migrate_complete(RedClient *client)
|
||||
{
|
||||
RedChannelClient *rcc;
|
||||
|
||||
@ -39,8 +39,6 @@ gboolean red_client_add_channel(RedClient *client, RedChannelClient *rcc, GError
|
||||
void red_client_remove_channel(RedChannelClient *rcc);
|
||||
|
||||
MainChannelClient *red_client_get_main(RedClient *client);
|
||||
// main should be set once before all the other channels are created
|
||||
void red_client_set_main(RedClient *client, MainChannelClient *mcc);
|
||||
|
||||
/* called when the migration handshake results in seamless migration (dst side).
|
||||
* By default we assume semi-seamless */
|
||||
|
||||
@ -1902,7 +1902,6 @@ static void reds_handle_main_link(RedsState *reds, RedLinkInfo *link)
|
||||
red_channel_capabilities_reset(&caps);
|
||||
spice_debug("NEW Client %p mcc %p connect-id %d", client, mcc, connection_id);
|
||||
g_free(link_mess);
|
||||
red_client_set_main(client, mcc);
|
||||
|
||||
if (reds->vdagent) {
|
||||
if (mig_target) {
|
||||
|
||||
@ -289,7 +289,6 @@ static void channel_loop(void)
|
||||
mcc = main_channel_link(main_channel, client, create_dummy_stream(server, NULL),
|
||||
0, FALSE, &caps);
|
||||
g_assert_nonnull(mcc);
|
||||
red_client_set_main(client, mcc);
|
||||
|
||||
// inject a trace into the core interface to count the events
|
||||
SpiceCoreInterfaceInternal *server_core = reds_get_core_interface(server);
|
||||
|
||||
@ -337,7 +337,6 @@ static void test_smartcard(TestFixture *fixture, gconstpointer user_data)
|
||||
mcc = main_channel_link(main_channel, client, create_dummy_stream(server, NULL),
|
||||
0, FALSE, &caps);
|
||||
g_assert_nonnull(mcc);
|
||||
red_client_set_main(client, mcc);
|
||||
|
||||
// create our testing RedChannelClient
|
||||
red_channel_connect(channel, client, create_dummy_stream(server, &client_socket),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user