[PATCH 2/7] server/dispatcher: add extra_dispatcher, hack for red_record

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

 



From: Alon Levy <alon@xxxxxxxxx>

---
 server/dispatcher.c | 10 ++++++++++
 server/dispatcher.h |  8 ++++++++
 2 files changed, 18 insertions(+)

diff --git a/server/dispatcher.c b/server/dispatcher.c
index ad9726b..e0fda1d 100644
--- a/server/dispatcher.c
+++ b/server/dispatcher.c
@@ -135,6 +135,9 @@ static int dispatcher_handle_single_read(Dispatcher *dispatcher)
         /* TODO: close socketpair? */
         return 0;
     }
+    if (dispatcher->extra_handler) {
+        dispatcher->extra_handler(dispatcher->opaque, type, (void *)payload);
+    }
     if (msg->handler) {
         msg->handler(dispatcher->opaque, type, (void *)payload);
     } else {
@@ -223,6 +226,13 @@ void dispatcher_register_handler(Dispatcher *dispatcher, uint32_t message_type,
     }
 }
 
+void dispatcher_register_extra_handler(
+                                    Dispatcher *dispatcher,
+                                    dispatcher_handle_message extra_handler)
+{
+    dispatcher->extra_handler = extra_handler;
+}
+
 #ifdef DEBUG_DISPATCHER
 static void dummy_handler(int bla)
 {
diff --git a/server/dispatcher.h b/server/dispatcher.h
index 85cbd26..edf6bab 100644
--- a/server/dispatcher.h
+++ b/server/dispatcher.h
@@ -33,6 +33,7 @@ struct Dispatcher {
     size_t payload_size; /* used to track realloc calls */
     void *opaque;
     dispatcher_handle_async_done handle_async_done;
+    dispatcher_handle_message extra_handler;
 };
 
 /*
@@ -86,6 +87,13 @@ void dispatcher_register_async_done_callback(
                                     dispatcher_handle_async_done handler);
 
 /*
+ * Hack to allow red_record to see the message being sent so it can record
+ * it to file.
+ */
+void dispatcher_register_extra_handler(Dispatcher *dispatcher,
+                                       dispatcher_handle_message handler);
+
+/*
  *  dispatcher_handle_recv_read
  *  @dispatcher: Dispatcher instance
  */
-- 
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]