[Spice-commits] server/red_dispatcher.h server/red_worker.c

Frediano Ziglio fziglio at kemper.freedesktop.org
Fri Oct 23 03:14:47 PDT 2015


 server/red_dispatcher.h |   12 ++++++------
 server/red_worker.c     |    8 +-------
 2 files changed, 7 insertions(+), 13 deletions(-)

New commits:
commit d3153f861065235c2a7a7120375be5db948c5a77
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date:   Mon Sep 2 19:10:57 2013 +0200

    worker: remove useless MESSAGE_READY
    
    Now that worker is created before running, and run() returns success,
    there is no point in using MESSAGE_READY.
    
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/red_dispatcher.h b/server/red_dispatcher.h
index 25811fa..9ee36d7 100644
--- a/server/red_dispatcher.h
+++ b/server/red_dispatcher.h
@@ -62,11 +62,6 @@ static inline void send_data(int fd, void *in_buf, int n)
     } while (n);
 }
 
-static inline void write_message(int fd, RedWorkerMessage *message)
-{
-    send_data(fd, message, sizeof(RedWorkerMessage));
-}
-
 static inline void receive_data(int fd, void *in_buf, int n)
 {
     uint8_t *buf = in_buf;
@@ -83,12 +78,17 @@ static inline void receive_data(int fd, void *in_buf, int n)
     } while (n);
 }
 
+/* Keep message order, only append new messages!
+ * Replay code store enum values into save files.
+ */
 enum {
     RED_WORKER_MESSAGE_NOP,
+
     RED_WORKER_MESSAGE_UPDATE,
     RED_WORKER_MESSAGE_WAKEUP,
     RED_WORKER_MESSAGE_OOM,
-    RED_WORKER_MESSAGE_READY,
+    RED_WORKER_MESSAGE_READY, /* unused */
+
     RED_WORKER_MESSAGE_DISPLAY_CONNECT,
     RED_WORKER_MESSAGE_DISPLAY_DISCONNECT,
     RED_WORKER_MESSAGE_DISPLAY_MIGRATE,
diff --git a/server/red_worker.c b/server/red_worker.c
index 8f1c42b..96d899d 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -11850,7 +11850,6 @@ static void handle_dev_input(int fd, int event, void *opaque)
 RedWorker* red_worker_new(WorkerInitData *init_data)
 {
     RedWorker *worker = spice_new0(RedWorker, 1);
-    RedWorkerMessage message;
     Dispatcher *dispatcher;
     int i;
     const char *record_filename;
@@ -11930,8 +11929,6 @@ RedWorker* red_worker_new(WorkerInitData *init_data)
     if (!spice_timer_queue_create()) {
         spice_error("failed to create timer queue");
     }
-    message = RED_WORKER_MESSAGE_READY;
-    write_message(worker->channel, &message);
 
     red_init_quic(worker);
     red_init_lz(worker);
@@ -12029,7 +12026,6 @@ SPICE_GNUC_NORETURN static void *red_worker_main(void *arg)
 
 bool red_worker_run(RedWorker *worker)
 {
-    uint32_t message;
     sigset_t thread_sig_mask;
     sigset_t curr_sig_mask;
     int r;
@@ -12047,7 +12043,5 @@ bool red_worker_run(RedWorker *worker)
     }
     pthread_sigmask(SIG_SETMASK, &curr_sig_mask, NULL);
 
-    message = dispatcher_read_message(red_dispatcher_get_dispatcher(worker->red_dispatcher));
-
-    return message == RED_WORKER_MESSAGE_READY;
+    return r == 0;
 }


More information about the Spice-commits mailing list