[PATCH spice-server 5/6] red-channel-client: Change initialization order

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A bit more similar to previous

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 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 6c78237..42f1d2c 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,23 +924,10 @@ 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);
     self->priv->id = red_channel_get_n_clients(self->priv->channel);
     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) {
-- 
2.7.4

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]