[Spice-devel] [PATCH] Implement vfuncs for DummyChannel

Jonathon Jongsma jjongsma at redhat.com
Tue Oct 25 17:14:55 UTC 2016


96e94c6f inadvertantly introduced a regression where an assert was
triggered in red_channel_constructed for DummyChannel since DummyChannel
didn't implement any of the expected RedChannel vfuncs. This patch
avoids the assert by assigning some empty vfuncs.
---

An alternate fix would be to refactor the code to avoid the use of DummyChannel
completely. I didn't go that route since I think Frediano might already be
working on this and I didn't want to duplicate his effort. But this could be a
temporary fix until that work is complete.

 server/dummy-channel.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/server/dummy-channel.c b/server/dummy-channel.c
index 3b65bce..85139f5 100644
--- a/server/dummy-channel.c
+++ b/server/dummy-channel.c
@@ -7,9 +7,37 @@
 
 G_DEFINE_TYPE(DummyChannel, dummy_channel, RED_TYPE_CHANNEL)
 
+static int dummy_config_socket(RedChannelClient *self)
+{
+    return TRUE;
+}
+
+static void dummy_on_disconnect(RedChannelClient *self)
+{
+}
+
+static uint8_t* dummy_alloc_recv_buf(RedChannelClient *self,
+                                     uint16_t type,
+                                     uint32_t size)
+{
+    return NULL;
+}
+
+static void dummy_release_recv_buf(RedChannelClient *self,
+                                   uint16_t type,
+                                   uint32_t size,
+                                   uint8_t *msg)
+{
+}
+
 static void
 dummy_channel_class_init(DummyChannelClass *klass)
 {
+    RedChannelClass *channel_class = RED_CHANNEL_CLASS(klass);
+    channel_class->config_socket = dummy_config_socket;
+    channel_class->on_disconnect = dummy_on_disconnect;
+    channel_class->alloc_recv_buf = dummy_alloc_recv_buf;
+    channel_class->release_recv_buf = dummy_release_recv_buf;
 }
 
 static void
-- 
2.7.4



More information about the Spice-devel mailing list