[Spice-commits] 3 commits - server/dispatcher.c server/dispatcher.h server/main-dispatcher.c server/red-worker.c

Jonathon Jongsma jjongsma at kemper.freedesktop.org
Thu Sep 7 16:24:08 UTC 2017


 server/dispatcher.c      |   19 +------
 server/dispatcher.h      |  125 ++++++++++++++++++++++++++++++-----------------
 server/main-dispatcher.c |    8 +--
 server/red-worker.c      |  108 +++++++++++++++++++---------------------
 4 files changed, 142 insertions(+), 118 deletions(-)

New commits:
commit a4450f928dda0592fd8545f77a10c33da42be05b
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date:   Fri Sep 1 13:40:28 2017 -0500

    Add documentation for Dispatcher

diff --git a/server/dispatcher.h b/server/dispatcher.h
index ab771384..1aaba13b 100644
--- a/server/dispatcher.h
+++ b/server/dispatcher.h
@@ -35,6 +35,18 @@ typedef struct Dispatcher Dispatcher;
 typedef struct DispatcherClass DispatcherClass;
 typedef struct DispatcherPrivate DispatcherPrivate;
 
+/* A Dispatcher provides inter-thread communication by serializing messages.
+ * Currently the Dispatcher uses a unix socket (socketpair) for dispatching the
+ * messages.
+ *
+ * Message types are identified by a unique integer value and must first be
+ * registered with the class (see dispatcher_register_handler()) before they
+ * can be sent. Sending threads can send a message using the
+ * dispatcher_send_message() function. The receiving thread can monitor the
+ * dispatcher's 'receive' file descriptor (see dispatcher_get_recv_fd()) for
+ * activity and should call dispatcher_handle_recv_read() to process incoming
+ * messages.
+ */
 struct Dispatcher
 {
     GObject parent;
@@ -49,26 +61,52 @@ struct DispatcherClass
 
 GType dispatcher_get_type(void) G_GNUC_CONST;
 
+/* dispatcher_new
+ *
+ * Create a new Dispatcher object
+ *
+ * @max_message_type:   indicates the number of unique message types that can
+ *                      be handled by this dispatcher. Each message type is
+ *                      identified by an integer value between 0 and
+ *                      max_message_type-1.
+ */
 Dispatcher *dispatcher_new(size_t max_message_type);
 
 
+/* The function signature for handlers of a specific message type */
 typedef void (*dispatcher_handle_message)(void *opaque,
                                           void *payload);
 
+/* The signature for a function that handles all messages (see
+ * dispatcher_register_universal_handler()) */
 typedef void (*dispatcher_handle_any_message)(void *opaque,
                                               uint32_t message_type,
                                               void *payload);
 
-/*
- * dispatcher_send_message
+/* dispatcher_send_message
+ *
+ * Sends a message to the receiving thread. The message type must have been
+ * registered first (see dispatcher_register_handler()).  @payload must be a
+ * buffer of the same size as the size registered for @message_type
+ *
+ * If the sent message is a message type requires an ACK, this function will
+ * block until it receives an ACK from the receiving thread.
+ *
  * @message_type: message type
  * @payload:      payload
  */
 void dispatcher_send_message(Dispatcher *dispatcher, uint32_t message_type,
                              void *payload);
 
-/*
- * dispatcher_register_handler
+/* dispatcher_register_handler
+ *
+ * This function registers a message type with the dispatcher, and registers
+ * @handler as the function that will handle incoming messages of this type.
+ * If @ack is true, the dispatcher will also send an ACK in response to the
+ * message after the message has been passed to the handler. You can only
+ * register a given message type once. For example, you cannot register two
+ * different handlers for the same message type with different @ack values.
+ *
  * @dispatcher:     dispatcher
  * @messsage_type:  message type
  * @handler:        message handler
@@ -79,32 +117,59 @@ void dispatcher_register_handler(Dispatcher *dispatcher, uint32_t message_type,
                                  dispatcher_handle_message handler, size_t size,
                                  bool ack);
 
-/*
- * Hack to allow red_record to see the message being sent so it can record
- * it to file.
+/* dispatcher_register_universal_handler
+ *
+ * Register a universal handler that will be called when *any* message is
+ * received by the dispatcher. When a message is received, this handler will be
+ * called first. If the received message type was registered via
+ * dispatcher_register_handler(), the message-specific handler will then be
+ * called. Only one universal handler can be registered. This feature can be
+ * used to record all messages to a file for replay and debugging.
+ *
+ * @dispatcher:     dispatcher
+ * @handler:        a handler function
  */
 void dispatcher_register_universal_handler(Dispatcher *dispatcher,
                                     dispatcher_handle_any_message handler);
 
-/*
- *  dispatcher_handle_recv_read
- *  @dispatcher: Dispatcher instance
+/* dispatcher_handle_recv_read
+ *
+ * A convenience function that is intended to be called by the receiving thread
+ * to handle all incoming messages and execute any handlers for those messages.
+ * This function will handle all incoming messages until there is no more data
+ * to read, so multiple handlers may be executed from a single call to
+ * dispatcher_handle_recv_read().
+ *
+ * @dispatcher: Dispatcher instance
  */
 void dispatcher_handle_recv_read(Dispatcher *);
 
-/*
- *  dispatcher_get_recv_fd
- *  @return: receive file descriptor of the dispatcher
+/* dispatcher_get_recv_fd
+ *
+ * This function returns the file descriptor that is used by the receiving
+ * thread to listen for incoming messages. You should not read or write
+ * directly to this fd, but should only use it to watch for read events. When
+ * there is a read event, you should use dispatcher_handle_recv_read() to
+ * handle the incoming messages.
+ *
+ * @return: receive file descriptor of the dispatcher
  */
 int dispatcher_get_recv_fd(Dispatcher *);
 
-/*
- * dispatcher_set_opaque
+/* dispatcher_set_opaque
+ *
+ * This @opaque pointer is user-defined data that will be passed as the first
+ * argument to all handler functions.
+ *
  * @dispatcher: Dispatcher instance
  * @opaque: opaque to use for callbacks
  */
 void dispatcher_set_opaque(Dispatcher *dispatcher, void *opaque);
 
+/* dispatcher_get_thread_id
+ *
+ * Returns the id of the thread that created this Dispatcher object
+ */
 pthread_t dispatcher_get_thread_id(Dispatcher *self);
 
 #endif /* DISPATCHER_H_ */
commit 39eba668329d3541860a7421c3d16e841c45f74b
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date:   Thu Sep 7 10:02:18 2017 -0500

    MainDispatcher: use correct argument type
    
    For dispatcher_register_handler(), use 'false' instead of 0 since the
    last argument is a bool type now.
    
    Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>

diff --git a/server/main-dispatcher.c b/server/main-dispatcher.c
index 71f8f65d..43f8b79a 100644
--- a/server/main-dispatcher.c
+++ b/server/main-dispatcher.c
@@ -314,16 +314,16 @@ void main_dispatcher_constructed(GObject *object)
                                     DISPATCHER(self));
     dispatcher_register_handler(DISPATCHER(self), MAIN_DISPATCHER_CHANNEL_EVENT,
                                 main_dispatcher_handle_channel_event,
-                                sizeof(MainDispatcherChannelEventMessage), 0 /* no ack */);
+                                sizeof(MainDispatcherChannelEventMessage), false);
     dispatcher_register_handler(DISPATCHER(self), MAIN_DISPATCHER_MIGRATE_SEAMLESS_DST_COMPLETE,
                                 main_dispatcher_handle_migrate_complete,
-                                sizeof(MainDispatcherMigrateSeamlessDstCompleteMessage), 0 /* no ack */);
+                                sizeof(MainDispatcherMigrateSeamlessDstCompleteMessage), false);
     dispatcher_register_handler(DISPATCHER(self), MAIN_DISPATCHER_SET_MM_TIME_LATENCY,
                                 main_dispatcher_handle_mm_time_latency,
-                                sizeof(MainDispatcherMmTimeLatencyMessage), 0 /* no ack */);
+                                sizeof(MainDispatcherMmTimeLatencyMessage), false);
     dispatcher_register_handler(DISPATCHER(self), MAIN_DISPATCHER_CLIENT_DISCONNECT,
                                 main_dispatcher_handle_client_disconnect,
-                                sizeof(MainDispatcherClientDisconnectMessage), 0 /* no ack */);
+                                sizeof(MainDispatcherClientDisconnectMessage), false);
 }
 
 static void main_dispatcher_finalize(GObject *object)
commit 439fa1574f1a43bdacdd7c2bbda5c8f78b4a2948
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date:   Wed Sep 6 14:11:59 2017 -0500

    Dispatcher: remove async_done callback
    
    This callback was only executed for message types that were registered
    with DISPATCHER_ASYNC ack type. However, the async_done handler was
    called immediately after the message-specific handler and was called in
    the same thread, so the async_done stuff can just as easily be done from
    within the message-specific handler. This allows to simplify the
    dispatcher_register_handler() method to simply require a boolean
    argument for whether the message type requires an ACK or not.
    
    Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>

diff --git a/server/dispatcher.c b/server/dispatcher.c
index 9e02d901..7fb706f8 100644
--- a/server/dispatcher.c
+++ b/server/dispatcher.c
@@ -40,7 +40,7 @@ static void setup_dummy_signal_handler(void);
 
 typedef struct DispatcherMessage {
     size_t size;
-    int ack;
+    bool ack;
     dispatcher_handle_message handler;
 } DispatcherMessage;
 
@@ -60,7 +60,6 @@ struct DispatcherPrivate {
     void *payload; /* allocated as max of message sizes */
     size_t payload_size; /* used to track realloc calls */
     void *opaque;
-    dispatcher_handle_async_done handle_async_done;
     dispatcher_handle_any_message any_handler;
 };
 
@@ -286,14 +285,12 @@ static int dispatcher_handle_single_read(Dispatcher *dispatcher)
     } else {
         spice_printerr("error: no handler for message type %d", type);
     }
-    if (msg->ack == DISPATCHER_ACK) {
+    if (msg->ack) {
         if (write_safe(dispatcher->priv->recv_fd,
                        (uint8_t*)&ack, sizeof(ack)) == -1) {
             spice_printerr("error writing ack for message %d", type);
             /* TODO: close socketpair? */
         }
-    } else if (msg->ack == DISPATCHER_ASYNC && dispatcher->priv->handle_async_done) {
-        dispatcher->priv->handle_async_done(dispatcher->priv->opaque, type, payload);
     }
     return 1;
 }
@@ -329,7 +326,7 @@ void dispatcher_send_message(Dispatcher *dispatcher, uint32_t message_type,
                    message_type);
         goto unlock;
     }
-    if (msg->ack == DISPATCHER_ACK) {
+    if (msg->ack) {
         if (read_safe(send_fd, (uint8_t*)&ack, sizeof(ack), 1) == -1) {
             spice_printerr("error: failed to read ack");
         } else if (ack != ACK) {
@@ -342,17 +339,9 @@ unlock:
     pthread_mutex_unlock(&dispatcher->priv->lock);
 }
 
-void dispatcher_register_async_done_callback(
-                                        Dispatcher *dispatcher,
-                                        dispatcher_handle_async_done handler)
-{
-    assert(dispatcher->priv->handle_async_done == NULL);
-    dispatcher->priv->handle_async_done = handler;
-}
-
 void dispatcher_register_handler(Dispatcher *dispatcher, uint32_t message_type,
                                  dispatcher_handle_message handler,
-                                 size_t size, int ack)
+                                 size_t size, bool ack)
 {
     DispatcherMessage *msg;
 
diff --git a/server/dispatcher.h b/server/dispatcher.h
index 00a828bd..ab771384 100644
--- a/server/dispatcher.h
+++ b/server/dispatcher.h
@@ -59,11 +59,6 @@ typedef void (*dispatcher_handle_any_message)(void *opaque,
                                               uint32_t message_type,
                                               void *payload);
 
-typedef void (*dispatcher_handle_async_done)(void *opaque,
-                                             uint32_t message_type,
-                                             void *payload);
-
-
 /*
  * dispatcher_send_message
  * @message_type: message type
@@ -72,38 +67,17 @@ typedef void (*dispatcher_handle_async_done)(void *opaque,
 void dispatcher_send_message(Dispatcher *dispatcher, uint32_t message_type,
                              void *payload);
 
-enum {
-    DISPATCHER_NONE = 0,
-    DISPATCHER_ACK,
-    DISPATCHER_ASYNC
-};
-
 /*
  * dispatcher_register_handler
  * @dispatcher:     dispatcher
  * @messsage_type:  message type
  * @handler:        message handler
  * @size:           message size. Each type has a fixed associated size.
- * @ack:            One of DISPATCHER_NONE, DISPATCHER_ACK, DISPATCHER_ASYNC.
- *                  DISPATCHER_NONE - only send the message
- *                  DISPATCHER_ACK - send an ack after the message
- *                  DISPATCHER_ASYNC - call send an ack. This is per message type - you can't send the
- *                  same message type with and without. Register two different
- *                  messages if that is what you want.
+ * @ack:            whether the dispatcher should send an ACK to the sender
  */
 void dispatcher_register_handler(Dispatcher *dispatcher, uint32_t message_type,
                                  dispatcher_handle_message handler, size_t size,
-                                 int ack);
-
-/*
- * dispatcher_register_async_done_callback
- * @dispatcher:     dispatcher
- * @handler:        callback on the receiver side called *after* the
- *                  message callback in case ack == DISPATCHER_ASYNC.
- */
-void dispatcher_register_async_done_callback(
-                                    Dispatcher *dispatcher,
-                                    dispatcher_handle_async_done handler);
+                                 bool ack);
 
 /*
  * Hack to allow red_record to see the message being sent so it can record
diff --git a/server/red-worker.c b/server/red-worker.c
index b18e0546..58d9e0ad 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -432,6 +432,7 @@ static void handle_dev_update_async(void *opaque, void *payload)
     red_qxl_update_area_complete(worker->qxl, msg->surface_id,
                                  qxl_dirty_rects, num_dirty_rects);
     free(qxl_dirty_rects);
+    red_qxl_async_complete(worker->qxl, msg->base.cmd);
 }
 
 static void handle_dev_update(void *opaque, void *payload)
@@ -582,14 +583,17 @@ static void handle_dev_destroy_primary_surface_async(void *opaque, void *payload
     uint32_t surface_id = msg->surface_id;
 
     destroy_primary_surface(worker, surface_id);
+    red_qxl_async_complete(worker->qxl, msg->base.cmd);
 }
 
 static void handle_dev_flush_surfaces_async(void *opaque, void *payload)
 {
     RedWorker *worker = opaque;
+    RedWorkerMessageFlushSurfacesAsync *msg = payload;
 
     flush_all_qxl_commands(worker);
     display_channel_flush_all_surfaces(worker->display_channel);
+    red_qxl_async_complete(worker->qxl, msg->base.cmd);
 }
 
 static void handle_dev_stop(void *opaque, void *payload)
@@ -689,15 +693,18 @@ static void handle_dev_destroy_surface_wait_async(void *opaque, void *payload)
     RedWorker *worker = opaque;
 
     display_channel_destroy_surface_wait(worker->display_channel, msg->surface_id);
+    red_qxl_async_complete(worker->qxl, msg->base.cmd);
 }
 
 static void handle_dev_destroy_surfaces_async(void *opaque, void *payload)
 {
     RedWorker *worker = opaque;
+    RedWorkerMessageDestroySurfacesAsync *msg = payload;
 
     flush_all_qxl_commands(worker);
     display_channel_destroy_surfaces(worker->display_channel);
     cursor_channel_reset(worker->cursor_channel);
+    red_qxl_async_complete(worker->qxl, msg->base.cmd);
 }
 
 static void handle_dev_create_primary_surface_async(void *opaque, void *payload)
@@ -706,6 +713,7 @@ static void handle_dev_create_primary_surface_async(void *opaque, void *payload)
     RedWorker *worker = opaque;
 
     dev_create_primary_surface(worker, msg->surface_id, msg->surface);
+    red_qxl_async_complete(worker->qxl, msg->base.cmd);
 }
 
 static void handle_dev_display_connect(void *opaque, void *payload)
@@ -774,21 +782,21 @@ static void handle_dev_monitors_config_async(void *opaque, void *payload)
 
     if (error) {
         /* TODO: raise guest bug (requires added QXL interface) */
-        return;
+        goto async_complete;
     }
     worker->driver_cap_monitors_config = 1;
     count = dev_monitors_config->count;
     max_allowed = dev_monitors_config->max_allowed;
     if (count == 0) {
         spice_warning("ignoring an empty monitors config message from driver");
-        return;
+        goto async_complete;
     }
     if (count > max_allowed) {
         spice_warning("ignoring malformed monitors_config from driver, "
                       "count > max_allowed %d > %d",
                       count,
                       max_allowed);
-        return;
+        goto async_complete;
     }
     /* get pointer again to check virtual size */
     dev_monitors_config =
@@ -797,11 +805,13 @@ static void handle_dev_monitors_config_async(void *opaque, void *payload)
                                              msg->group_id, &error);
     if (error) {
         /* TODO: raise guest bug (requires added QXL interface) */
-        return;
+        goto async_complete;
     }
     display_channel_update_monitors_config(worker->display_channel, dev_monitors_config,
                                            MIN(count, msg->max_monitors),
                                            MIN(max_allowed, msg->max_monitors));
+async_complete:
+    red_qxl_async_complete(worker->qxl, msg->base.cmd);
 }
 
 /* TODO: special, perhaps use another dispatcher? */
@@ -928,6 +938,7 @@ static void handle_dev_add_memslot_async(void *opaque, void *payload)
     RedWorker *worker = opaque;
 
     dev_add_memslot(worker, msg->mem_slot);
+    red_qxl_async_complete(worker->qxl, msg->base.cmd);
 }
 
 static void handle_dev_reset_memslots(void *opaque, void *payload)
@@ -1000,17 +1011,6 @@ static void handle_dev_loadvm_commands(void *opaque, void *payload)
     }
 }
 
-static void worker_handle_dispatcher_async_done(void *opaque,
-                                                uint32_t message_type,
-                                                void *payload)
-{
-    RedWorker *worker = opaque;
-    RedWorkerMessageAsync *msg_async = payload;
-
-    spice_debug("trace");
-    red_qxl_async_complete(worker->qxl, msg_async->cmd);
-}
-
 static void worker_dispatcher_record(void *opaque, uint32_t message_type, void *payload)
 {
     RedWorker *worker = opaque;
@@ -1020,196 +1020,192 @@ static void worker_dispatcher_record(void *opaque, uint32_t message_type, void *
 
 static void register_callbacks(Dispatcher *dispatcher)
 {
-    dispatcher_register_async_done_callback(
-                                    dispatcher,
-                                    worker_handle_dispatcher_async_done);
-
     /* TODO: register cursor & display specific msg in respective channel files */
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_DISPLAY_CONNECT,
                                 handle_dev_display_connect,
                                 sizeof(RedWorkerMessageDisplayConnect),
-                                DISPATCHER_NONE);
+                                false);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_DISPLAY_DISCONNECT,
                                 handle_dev_display_disconnect,
                                 sizeof(RedWorkerMessageDisplayDisconnect),
-                                DISPATCHER_ACK);
+                                true);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_DISPLAY_MIGRATE,
                                 handle_dev_display_migrate,
                                 sizeof(RedWorkerMessageDisplayMigrate),
-                                DISPATCHER_NONE);
+                                false);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_CURSOR_CONNECT,
                                 handle_dev_cursor_connect,
                                 sizeof(RedWorkerMessageCursorConnect),
-                                DISPATCHER_NONE);
+                                false);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_CURSOR_DISCONNECT,
                                 handle_dev_cursor_disconnect,
                                 sizeof(RedWorkerMessageCursorDisconnect),
-                                DISPATCHER_ACK);
+                                true);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_CURSOR_MIGRATE,
                                 handle_dev_cursor_migrate,
                                 sizeof(RedWorkerMessageCursorMigrate),
-                                DISPATCHER_NONE);
+                                false);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_UPDATE,
                                 handle_dev_update,
                                 sizeof(RedWorkerMessageUpdate),
-                                DISPATCHER_ACK);
+                                true);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_UPDATE_ASYNC,
                                 handle_dev_update_async,
                                 sizeof(RedWorkerMessageUpdateAsync),
-                                DISPATCHER_ASYNC);
+                                false);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_ADD_MEMSLOT,
                                 handle_dev_add_memslot,
                                 sizeof(RedWorkerMessageAddMemslot),
-                                DISPATCHER_ACK);
+                                true);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_ADD_MEMSLOT_ASYNC,
                                 handle_dev_add_memslot_async,
                                 sizeof(RedWorkerMessageAddMemslotAsync),
-                                DISPATCHER_ASYNC);
+                                false);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_DEL_MEMSLOT,
                                 handle_dev_del_memslot,
                                 sizeof(RedWorkerMessageDelMemslot),
-                                DISPATCHER_NONE);
+                                false);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_DESTROY_SURFACES,
                                 handle_dev_destroy_surfaces,
                                 sizeof(RedWorkerMessageDestroySurfaces),
-                                DISPATCHER_ACK);
+                                true);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_DESTROY_SURFACES_ASYNC,
                                 handle_dev_destroy_surfaces_async,
                                 sizeof(RedWorkerMessageDestroySurfacesAsync),
-                                DISPATCHER_ASYNC);
+                                false);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_DESTROY_PRIMARY_SURFACE,
                                 handle_dev_destroy_primary_surface,
                                 sizeof(RedWorkerMessageDestroyPrimarySurface),
-                                DISPATCHER_ACK);
+                                true);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_DESTROY_PRIMARY_SURFACE_ASYNC,
                                 handle_dev_destroy_primary_surface_async,
                                 sizeof(RedWorkerMessageDestroyPrimarySurfaceAsync),
-                                DISPATCHER_ASYNC);
+                                false);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_CREATE_PRIMARY_SURFACE_ASYNC,
                                 handle_dev_create_primary_surface_async,
                                 sizeof(RedWorkerMessageCreatePrimarySurfaceAsync),
-                                DISPATCHER_ASYNC);
+                                false);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_CREATE_PRIMARY_SURFACE,
                                 handle_dev_create_primary_surface,
                                 sizeof(RedWorkerMessageCreatePrimarySurface),
-                                DISPATCHER_ACK);
+                                true);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_RESET_IMAGE_CACHE,
                                 handle_dev_reset_image_cache,
                                 sizeof(RedWorkerMessageResetImageCache),
-                                DISPATCHER_ACK);
+                                true);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_RESET_CURSOR,
                                 handle_dev_reset_cursor,
                                 sizeof(RedWorkerMessageResetCursor),
-                                DISPATCHER_ACK);
+                                true);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_WAKEUP,
                                 handle_dev_wakeup,
                                 sizeof(RedWorkerMessageWakeup),
-                                DISPATCHER_NONE);
+                                false);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_OOM,
                                 handle_dev_oom,
                                 sizeof(RedWorkerMessageOom),
-                                DISPATCHER_NONE);
+                                false);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_START,
                                 handle_dev_start,
                                 sizeof(RedWorkerMessageStart),
-                                DISPATCHER_NONE);
+                                false);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_FLUSH_SURFACES_ASYNC,
                                 handle_dev_flush_surfaces_async,
                                 sizeof(RedWorkerMessageFlushSurfacesAsync),
-                                DISPATCHER_ASYNC);
+                                false);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_STOP,
                                 handle_dev_stop,
                                 sizeof(RedWorkerMessageStop),
-                                DISPATCHER_ACK);
+                                true);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_LOADVM_COMMANDS,
                                 handle_dev_loadvm_commands,
                                 sizeof(RedWorkerMessageLoadvmCommands),
-                                DISPATCHER_ACK);
+                                true);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_SET_COMPRESSION,
                                 handle_dev_set_compression,
                                 sizeof(RedWorkerMessageSetCompression),
-                                DISPATCHER_NONE);
+                                false);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_SET_STREAMING_VIDEO,
                                 handle_dev_set_streaming_video,
                                 sizeof(RedWorkerMessageSetStreamingVideo),
-                                DISPATCHER_NONE);
+                                false);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_SET_VIDEO_CODECS,
                                 handle_dev_set_video_codecs,
                                 sizeof(RedWorkerMessageSetVideoCodecs),
-                                DISPATCHER_NONE);
+                                false);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_SET_MOUSE_MODE,
                                 handle_dev_set_mouse_mode,
                                 sizeof(RedWorkerMessageSetMouseMode),
-                                DISPATCHER_NONE);
+                                false);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_DESTROY_SURFACE_WAIT,
                                 handle_dev_destroy_surface_wait,
                                 sizeof(RedWorkerMessageDestroySurfaceWait),
-                                DISPATCHER_ACK);
+                                true);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_DESTROY_SURFACE_WAIT_ASYNC,
                                 handle_dev_destroy_surface_wait_async,
                                 sizeof(RedWorkerMessageDestroySurfaceWaitAsync),
-                                DISPATCHER_ASYNC);
+                                false);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_RESET_MEMSLOTS,
                                 handle_dev_reset_memslots,
                                 sizeof(RedWorkerMessageResetMemslots),
-                                DISPATCHER_NONE);
+                                false);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_MONITORS_CONFIG_ASYNC,
                                 handle_dev_monitors_config_async,
                                 sizeof(RedWorkerMessageMonitorsConfigAsync),
-                                DISPATCHER_ASYNC);
+                                false);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_DRIVER_UNLOAD,
                                 handle_dev_driver_unload,
                                 sizeof(RedWorkerMessageDriverUnload),
-                                DISPATCHER_NONE);
+                                false);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_GL_SCANOUT,
                                 handle_dev_gl_scanout,
                                 sizeof(RedWorkerMessageGlScanout),
-                                DISPATCHER_NONE);
+                                false);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_GL_DRAW_ASYNC,
                                 handle_dev_gl_draw_async,
                                 sizeof(RedWorkerMessageGlDraw),
-                                DISPATCHER_NONE);
+                                false);
     dispatcher_register_handler(dispatcher,
                                 RED_WORKER_MESSAGE_CLOSE_WORKER,
                                 handle_dev_close,
                                 sizeof(RedWorkerMessageClose),
-                                DISPATCHER_NONE);
+                                false);
 }
 
 


More information about the Spice-commits mailing list