[Spice-devel] [PATCH 8/9] worker: use glib main loop

Jonathon Jongsma jjongsma at redhat.com
Thu Oct 22 11:55:15 PDT 2015


On Wed, 2015-10-21 at 21:45 +0200, Fabiano FidĂȘncio wrote:
> On Wed, Oct 21, 2015 at 2:00 PM, Frediano Ziglio <fziglio at redhat.com>
> wrote:
> > From: Marc-André Lureau <marcandre.lureau at gmail.com>
> > 
> > Clean up, more extensible.
> > 
> 
> Not exactly sure what it means.
> 
> > Avoid server hanging when no client are connected.
> 
> How does this patch avoid server hanging when no client is connected?
> Is it a side-effect of using the glib main loop? If not, commit must
> be split.
> 
> Note: I still didn't go through this patch ...


Perhaps it is the following hunk? if so, it seems fairly easy to split.

@@ -4720,14 +4669,30 @@ static int red_process_commands(RedWorker
*worker, uint32_t max_pipe_size, int *
 
     worker->process_commands_generation++;
     *ring_is_empty = FALSE;
-    while (!display_is_connected(worker) ||
-           // TODO: change to average pipe size?
-           red_channel_min_pipe_size(&worker->display_channel
->common.base) <= max_pipe_size) {
+    for (;;) {
+
+        if (display_is_connected(worker)) {
+
+            if (red_channel_all_blocked(&worker->display_channel
->common.base)) {
+                spice_info("all display clients are blocking");
+                return n;
+            }
+
+
+            // TODO: change to average pipe size?
+            if (red_channel_min_pipe_size(&worker->display_channel
->common.base) > max_pipe_size) {
+                spice_info("too much item in the display clients pipe
already");
+                return n;
+            }
+        }
+




More information about the Spice-devel mailing list