[spice-server] playback: Don't lose client connection after migration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit 590acf3c556 introduced a regression after migration:
PlaybackChannel::connection is never set even if a client is connected,
which means the playback channel is non-functional until a client
reconnects as all the snd_channel_set_xxx() method checks for a non-NULL
PlaybackChannel::connection before sending data to the client.

This commit slightly changes the code flow in
on_new_playback_channel_client()/playback_channel_client_constructed()
so that PlaybackChannel::connection is set regardless of what
red_client_during_migrate_at_target() returns. This is what was done
prior to 590acf3c556.

This resolves https://bugs.freedesktop.org/show_bug.cgi?id=100136

Signed-off-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>
---
 server/sound.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/server/sound.c b/server/sound.c
index 6a6d965..b50f9fc 100644
--- a/server/sound.c
+++ b/server/sound.c
@@ -991,10 +991,14 @@ static int snd_desired_audio_mode(bool playback_compression, int frequency,
 static void on_new_playback_channel_client(SndChannel *channel, SndChannelClient *client)
 {
     RedsState *reds = red_channel_get_server(RED_CHANNEL(channel));
+    RedClient *red_client = red_channel_client_get_client(RED_CHANNEL_CLIENT(client));
 
     spice_assert(client);
 
     channel->connection = client;
+    if (red_client_during_migrate_at_target(red_client)) {
+        return;
+    }
     snd_set_command(client, SND_PLAYBACK_MODE_MASK);
     if (client->active) {
         snd_set_command(client, SND_CTRL_MASK);
@@ -1036,7 +1040,6 @@ playback_channel_client_constructed(GObject *object)
 {
     PlaybackChannelClient *playback_client = PLAYBACK_CHANNEL_CLIENT(object);
     RedChannel *red_channel = red_channel_client_get_channel(RED_CHANNEL_CLIENT(playback_client));
-    RedClient *client = red_channel_client_get_client(RED_CHANNEL_CLIENT(playback_client));
     SndChannel *channel = SND_CHANNEL(red_channel);
 
     G_OBJECT_CLASS(playback_channel_client_parent_class)->constructed(object);
@@ -1061,9 +1064,7 @@ playback_channel_client_constructed(GObject *object)
         }
     }
 
-    if (!red_client_during_migrate_at_target(client)) {
-        on_new_playback_channel_client(channel, SND_CHANNEL_CLIENT(playback_client));
-    }
+    on_new_playback_channel_client(channel, SND_CHANNEL_CLIENT(playback_client));
 
     if (channel->active) {
         snd_playback_start(channel);
-- 
2.9.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]