[Spice-devel] [PATCH 11/16] worker: merge handle_new_display_channel

Frediano Ziglio fziglio at redhat.com
Thu Nov 26 08:06:08 PST 2015


From: Marc-André Lureau <marcandre.lureau at gmail.com>

---
 server/red_worker.c | 49 ++++++++++++++++---------------------------------
 1 file changed, 16 insertions(+), 33 deletions(-)

diff --git a/server/red_worker.c b/server/red_worker.c
index 2a58052..cf20ccd 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -722,31 +722,6 @@ static void guest_set_client_capabilities(RedWorker *worker)
     }
 }
 
-static void handle_new_display_channel(RedWorker *worker, RedClient *client, RedsStream *stream,
-                                       int migrate,
-                                       uint32_t *common_caps, int num_common_caps,
-                                       uint32_t *caps, int num_caps)
-{
-    DisplayChannel *display;
-    DisplayChannelClient *dcc;
-
-    spice_return_if_fail(worker->display_channel);
-
-    display = worker->display_channel;
-    spice_info("add display channel client");
-    dcc = dcc_new(display, client, stream, migrate,
-                  common_caps, num_common_caps, caps, num_caps,
-                  worker->image_compression, worker->jpeg_state, worker->zlib_glz_state);
-    if (!dcc) {
-        return;
-    }
-
-    display_channel_update_compression(display, dcc);
-
-    guest_set_client_capabilities(worker);
-    dcc_start(dcc);
-}
-
 static void cursor_connect(RedWorker *worker, RedClient *client, RedsStream *stream,
                            int migrate,
                            uint32_t *common_caps, int num_common_caps,
@@ -1107,14 +1082,22 @@ static void handle_dev_display_connect(void *opaque, void *payload)
 {
     RedWorkerMessageDisplayConnect *msg = payload;
     RedWorker *worker = opaque;
-    RedsStream *stream = msg->stream;
-    RedClient *client = msg->client;
-    int migration = msg->migration;
-
-    spice_info("connect");
-    handle_new_display_channel(worker, client, stream, migration,
-                               msg->common_caps, msg->num_common_caps,
-                               msg->caps, msg->num_caps);
+    DisplayChannel *display = worker->display_channel;
+    DisplayChannelClient *dcc;
+
+    spice_info("connect new client");
+    spice_return_if_fail(display);
+
+    dcc = dcc_new(display, msg->client, msg->stream, msg->migration,
+                  msg->common_caps, msg->num_common_caps, msg->caps, msg->num_caps,
+                  worker->image_compression, worker->jpeg_state, worker->zlib_glz_state);
+    if (!dcc) {
+        return;
+    }
+    display_channel_update_compression(display, dcc);
+    guest_set_client_capabilities(worker);
+    dcc_start(dcc);
+
     free(msg->caps);
     free(msg->common_caps);
 }
-- 
2.4.3



More information about the Spice-devel mailing list