[Spice-devel] [spice-gtk 10/13] channel: simplify has error code
Christophe Fergeau
cfergeau at redhat.com
Wed Feb 12 03:33:53 PST 2014
ACK
Christophe
On Mon, Feb 03, 2014 at 07:02:41PM +0100, Marc-André Lureau wrote:
> From: Marc-André Lureau <marcandre.lureau at redhat.com>
>
> Get rid of a superflous g_socket_condition_check().
> ---
> gtk/spice-channel.c | 28 +++++++++++-----------------
> 1 file changed, 11 insertions(+), 17 deletions(-)
>
> diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
> index 7459a49..87bc471 100644
> --- a/gtk/spice-channel.c
> +++ b/gtk/spice-channel.c
> @@ -2105,29 +2105,23 @@ static gboolean wait_migration(gpointer data)
> static gboolean spice_channel_iterate(SpiceChannel *channel)
> {
> SpiceChannelPrivate *c = channel->priv;
> - GIOCondition ret;
>
> if (c->state == SPICE_CHANNEL_STATE_MIGRATING &&
> !g_coroutine_condition_wait(&c->coroutine, wait_migration, channel))
> CHANNEL_DEBUG(channel, "migration wait cancelled");
>
> - if (c->has_error) {
> - CHANNEL_DEBUG(channel, "channel has error, breaking loop");
> - return FALSE;
> - }
> -
> /* flush any pending write and read */
> - SPICE_CHANNEL_GET_CLASS(channel)->iterate_write(channel);
> - SPICE_CHANNEL_GET_CLASS(channel)->iterate_read(channel);
> -
> - ret = g_socket_condition_check(c->sock, G_IO_IN | G_IO_ERR | G_IO_HUP);
> - if (c->state > SPICE_CHANNEL_STATE_CONNECTING &&
> - ret & (G_IO_ERR|G_IO_HUP)) {
> - SPICE_DEBUG("got socket error: %d", ret);
> - emit_main_context(channel, SPICE_CHANNEL_EVENT,
> - c->state == SPICE_CHANNEL_STATE_READY ?
> - SPICE_CHANNEL_ERROR_IO : SPICE_CHANNEL_ERROR_LINK);
> - c->has_error = TRUE;
> + if (!c->has_error)
> + SPICE_CHANNEL_GET_CLASS(channel)->iterate_write(channel);
> + if (!c->has_error)
> + SPICE_CHANNEL_GET_CLASS(channel)->iterate_read(channel);
> +
> + if (c->has_error) {
> + CHANNEL_DEBUG(channel, "channel got error");
> + if (c->state > SPICE_CHANNEL_STATE_CONNECTING)
> + emit_main_context(channel, SPICE_CHANNEL_EVENT,
> + c->state == SPICE_CHANNEL_STATE_READY ?
> + SPICE_CHANNEL_ERROR_IO : SPICE_CHANNEL_ERROR_LINK);
> return FALSE;
> }
>
> --
> 1.8.4.2
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20140212/889622ab/attachment.pgp>
More information about the Spice-devel
mailing list