[PATCH 20/22] worker: make sure we dispatch after releasing items

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

 



From: Marc-André Lureau <marcandre.lureau@xxxxxxxxx>

---
 server/display-channel.c |  2 ++
 server/red_worker.c      | 10 ++++++++++
 server/red_worker.h      |  1 +
 3 files changed, 13 insertions(+)

diff --git a/server/display-channel.c b/server/display-channel.c
index d168190..6b9affc 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -1968,9 +1968,11 @@ static void hold_item(RedChannelClient *rcc, PipeItem *item)
 static void release_item(RedChannelClient *rcc, PipeItem *item, int item_pushed)
 {
     DisplayChannelClient *dcc = RCC_TO_DCC(rcc);
+    RedWorker *worker = DCC_TO_WORKER(dcc);
 
     spice_return_if_fail(item != NULL);
     dcc_release_item(dcc, item, item_pushed);
+    red_worker_update_timeout(worker, 0);
 }
 
 static int handle_migrate_flush_mark(RedChannelClient *rcc)
diff --git a/server/red_worker.c b/server/red_worker.c
index 98115b1..435b7fa 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -110,6 +110,14 @@ RedMemSlotInfo* red_worker_get_memslot(RedWorker *worker)
     return &worker->mem_slots;
 }
 
+void red_worker_update_timeout(RedWorker *worker, gint timeout)
+{
+    spice_return_if_fail(worker != NULL);
+    spice_return_if_fail(timeout >= 0);
+
+    worker->timeout = MIN(worker->timeout, timeout);
+}
+
 static int display_is_connected(RedWorker *worker)
 {
     return (worker->display_channel && red_channel_is_connected(
@@ -1641,6 +1649,8 @@ static gboolean worker_source_prepare(GSource *source, gint *timeout)
     *timeout = worker->timeout;
     *timeout = MIN(worker->timeout,
                    display_channel_get_streams_timeout(worker->display_channel));
+    if (*timeout == 0)
+        return TRUE;
 
     return FALSE; /* do no timeout poll */
 }
diff --git a/server/red_worker.h b/server/red_worker.h
index bfbc616..236c2f8 100644
--- a/server/red_worker.h
+++ b/server/red_worker.h
@@ -94,6 +94,7 @@ static inline void red_pipes_add_verb(RedChannel *channel, uint16_t verb)
 
 RedWorker* red_worker_new(QXLInstance *qxl, RedDispatcher *red_dispatcher);
 bool       red_worker_run(RedWorker *worker);
+void       red_worker_update_timeout(RedWorker *worker, gint timeout);
 QXLInstance* red_worker_get_qxl(RedWorker *worker);
 RedChannel* red_worker_get_cursor_channel(RedWorker *worker);
 RedChannel* red_worker_get_display_channel(RedWorker *worker);
-- 
2.4.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://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]