[Spice-devel] [PATCH] channel: support multiple clients for red_channel_is_waiting_for_migrate_data

Frediano Ziglio fziglio at redhat.com
Thu Dec 10 15:12:40 PST 2015


> 
> Hi
> 
> Did you test this?
> 

What do you mean?

> I thought only a single client was handling server migration data. At least
> intuitively, that's what I think it should do.
> 

The function is testing if there are at least one client waiting for migration data.

Frediano

> ----- Original Message -----
> > Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> > ---
> >  server/red-channel.c | 21 ++++++++++++++-------
> >  1 file changed, 14 insertions(+), 7 deletions(-)
> > 
> > diff --git a/server/red-channel.c b/server/red-channel.c
> > index 7dfb9bf..18f890f 100644
> > --- a/server/red-channel.c
> > +++ b/server/red-channel.c
> > @@ -963,20 +963,27 @@ int
> > red_channel_client_is_waiting_for_migrate_data(RedChannelClient *rcc)
> >      return rcc->wait_migrate_data;
> >  }
> >  
> > +/**
> > + * Returns TRUE is at least one client is waiting for migration data
> > + */
> >  int red_channel_is_waiting_for_migrate_data(RedChannel *channel)
> >  {
> > -    RedChannelClient *rcc;
> > +    RingItem *link, *next;
> >  
> > -    if (!red_channel_is_connected(channel)) {
> > +    if (!channel) {
> >          return FALSE;
> >      }
> >  
> > -    if (channel->clients_num > 1) {
> > -        return FALSE;
> > +    RING_FOREACH_SAFE(link, next, &channel->clients) {
> > +        RedChannelClient *rcc;
> > +
> > +        rcc = SPICE_CONTAINEROF(link, RedChannelClient, channel_link);
> > +        if (red_channel_client_is_waiting_for_migrate_data(rcc)) {
> > +            return TRUE;
> > +        }
> >      }
> > -    spice_assert(channel->clients_num == 1);
> > -    rcc = SPICE_CONTAINEROF(ring_get_head(&channel->clients),
> > RedChannelClient, channel_link);
> > -    return red_channel_client_is_waiting_for_migrate_data(rcc);
> > +
> > +    return FALSE;
> >  }
> >  
> >  static void red_channel_client_default_connect(RedChannel *channel,
> >  RedClient *client,
> > --
> > 2.4.3
> > 


More information about the Spice-devel mailing list