[Spice-devel] [PATCH spice-gtk 12/13] migration: don't check socket error
Christophe Fergeau
cfergeau at redhat.com
Wed Nov 12 08:38:07 PST 2014
On Sun, Nov 09, 2014 at 05:31:44PM +0100, Marc-André Lureau wrote:
> During migration, the original socket is closed before coroutine
> finishes, so it's not guarantee to have c->sock on errors.
I'd go with something like
"During migration, the original socket is closed before the coroutine
finishes, so it's not guaranteed that c->sock will
still be set when the channel is in an error state in
spice_channel_iterate()".
> ---
> gtk/spice-channel.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
> index 9375c68..571eeb1 100644
> --- a/gtk/spice-channel.c
> +++ b/gtk/spice-channel.c
> @@ -2140,6 +2140,10 @@ static gboolean spice_channel_iterate(SpiceChannel *channel)
>
> if (c->has_error) {
> GIOCondition ret;
> +
> + if (!c->sock)
> + return FALSE;
> +
> /* We don't want to report an error if the socket was closed gracefully
> * on the other end (VM shutdown) */
> ret = g_socket_condition_check(c->sock, G_IO_IN | G_IO_ERR | G_IO_HUP);
> @@ -2544,6 +2548,7 @@ static void channel_reset(SpiceChannel *channel, gboolean migrating)
> {
> SpiceChannelPrivate *c = channel->priv;
>
> + CHANNEL_DEBUG(channel, "channel reset");
> if (c->connect_delayed_id) {
> g_source_remove(c->connect_delayed_id);
> c->connect_delayed_id = 0;
> @@ -2610,6 +2615,7 @@ static void channel_reset(SpiceChannel *channel, gboolean migrating)
> G_GNUC_INTERNAL
> void spice_channel_reset(SpiceChannel *channel, gboolean migrating)
> {
> + CHANNEL_DEBUG(channel, "reset %s", migrating ? "migrating" : "");
> SPICE_CHANNEL_GET_CLASS(channel)->channel_reset(channel, migrating);
> }
These debug statements do not belong here, looks good otherwise, ACK.
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/d79a087f/attachment.sig>
More information about the Spice-devel
mailing list