From 654dfa4ca5fc443cefbc43a5cbdcf3a9b43292fc Mon Sep 17 00:00:00 2001 From: Frediano Ziglio Date: Thu, 27 Oct 2016 13:25:40 +0100 Subject: [PATCH] red-channel-client: Change initialization order Make the order of initialization closer to what it was before conversion to GObject. Signed-off-by: Frediano Ziglio Acked-by: Jonathon Jongsma --- server/red-channel-client.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/server/red-channel-client.c b/server/red-channel-client.c index ad6b3e62..a28f5e66 100644 --- a/server/red-channel-client.c +++ b/server/red-channel-client.c @@ -896,7 +896,22 @@ static gboolean red_channel_client_initable_init(GInitable *initable, goto cleanup; } + if (!red_channel_config_socket(self->priv->channel, self)) { + g_set_error_literal(&local_error, + SPICE_SERVER_ERROR, + SPICE_SERVER_ERROR_FAILED, + "Unable to configure socket"); + goto cleanup; + } + core = red_channel_get_core_interface(self->priv->channel); + if (self->priv->stream) + self->priv->stream->watch = + core->watch_add(core, self->priv->stream->socket, + SPICE_WATCH_EVENT_READ, + red_channel_client_event, + self); + if (self->priv->monitor_latency && reds_stream_get_family(self->priv->stream) != AF_UNIX) { self->priv->latency_monitor.timer = @@ -909,22 +924,9 @@ static gboolean red_channel_client_initable_init(GInitable *initable, self->priv->latency_monitor.roundtrip = -1; } - if (self->priv->stream) - self->priv->stream->watch = - core->watch_add(core, self->priv->stream->socket, - SPICE_WATCH_EVENT_READ, - red_channel_client_event, - self); red_channel_add_client(self->priv->channel, self); red_client_add_channel(self->priv->client, self); - if (!red_channel_config_socket(self->priv->channel, self)) { - g_set_error_literal(&local_error, - SPICE_SERVER_ERROR, - SPICE_SERVER_ERROR_FAILED, - "Unable to configure socket"); - } - cleanup: pthread_mutex_unlock(&self->priv->client->lock); if (local_error) {