[Spice-devel] [PATCH spice-gtk 06/13] migration: set connecting state before fd request

Christophe Fergeau cfergeau at redhat.com
Wed Nov 12 09:35:30 PST 2014


On Wed, Nov 12, 2014 at 12:13:07PM -0500, Marc-André Lureau wrote:
> 
> 
> ----- Original Message -----
> > On Wed, Nov 12, 2014 at 11:27:28AM -0500, Marc-André Lureau wrote:
> > > 
> > > 
> > > ----- Original Message -----
> > > > On Sun, Nov 09, 2014 at 05:31:38PM +0100, Marc-André Lureau wrote:
> > > > > During migration, the main channel initiating the process is waiting on
> > > > > connection completion or error. However, if the migration is cancelled,
> > > > > but the main channel state is still NONE, no error event will be fired,
> > > > > and the main channel will remain frozen.
> > > > 
> > > > Do you mean SPICE_CHANNEL_STATE_UNCONNECTED rather than 'NONE' and are
> > > > you referring to the
> > > > if (c->state == SPICE_CHANNEL_STATE_UNCONNECTED)
> > > >     return;
> > > > 
> > > > c->has_error = TRUE; /* break the loop */
> > > > 
> > > > blocks in channel_disconnect/spice_channel_disconnect() ?
> > > 
> > > 
> > > This in spice_channel_disconnect():
> > > 
> > >    if (reason != SPICE_CHANNEL_NONE)
> > >         g_signal_emit(G_OBJECT(channel), signals[SPICE_CHANNEL_EVENT], 0,
> > >         reason);
> > 
> > I've seen that bit, but SPICE_CHANNEL_NONE is a SpiceChannelEvent, not a
> > spice_channel_state, and even after looking at the various
> > spice_channel_disconnect() call sites it's not obvious how this relates
> > to this change.
> > 
> 
> The reason will be set on error, signal will be emitted. But channel
> state must be != STATE_UNCONNECTED. 

'git grep spice_channel_disconnect' gives:
doc/reference/spice-gtk-sections.txt:spice_channel_disconnect
gtk/channel-main.c:    spice_channel_disconnect(channel, SPICE_CHANNEL_SWITCHING);
gtk/map-file:spice_channel_disconnect;
gtk/spice-channel.c:    spice_channel_disconnect(channel, SPICE_CHANNEL_CLOSED);
gtk/spice-channel.c:    spice_channel_disconnect(channel, SPICE_CHANNEL_NONE);
gtk/spice-channel.c: * spice_channel_disconnect:
gtk/spice-channel.c:void spice_channel_disconnect(SpiceChannel *channel, SpiceChannelEvent reason)
gtk/spice-channel.h:void spice_channel_disconnect(SpiceChannel *channel, SpiceChannelEvent reason);
gtk/spice-glib-sym-file:spice_channel_disconnect
gtk/spicy.c:    spice_channel_disconnect(channel, SPICE_CHANNEL_CLOSED);

so the 'reason' argument to spice_channel_disconnect() will never indicate an error.
I think the code path you want to get triggered is the 'c->has_error = TRUE' part of
spice_channel_disconnect() (which is not called when c->state is SPICE_CHANNEL_STATE_UNCONNECTED).
Once 'has_error' is set to TRUE, this will trigger the emission of an error in spice_channel_iterate()

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20141112/229261eb/attachment.sig>


More information about the Spice-devel mailing list