[Spice-devel] [PATCH spice-gtk 9/9] spice-channel: cleanup, remove spice_channel_send_msg()

Hans de Goede hdegoede at redhat.com
Wed Dec 14 06:14:09 PST 2011


There are only 2 callers, both of which want it to do a different thing,
making the callers do this directly allows us to remove
spice_channel_send_msg(); and gets rid of the weirdness where we've a
function which can be called in both co-routine and system context.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 gtk/spice-channel.c |   23 ++++-------------------
 1 files changed, 4 insertions(+), 19 deletions(-)

diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
index 9c9e444..b6779ba 100644
--- a/gtk/spice-channel.c
+++ b/gtk/spice-channel.c
@@ -42,7 +42,7 @@
 #include "gio-coroutine.h"
 
 static void spice_channel_handle_msg(SpiceChannel *channel, SpiceMsgIn *msg);
-static void spice_channel_send_msg(SpiceChannel *channel, SpiceMsgOut *out, gboolean buffered);
+static void spice_channel_write_msg(SpiceChannel *channel, SpiceMsgOut *out);
 static void spice_channel_send_link(SpiceChannel *channel);
 static void channel_disconnect(SpiceChannel *channel);
 
@@ -539,8 +539,9 @@ G_GNUC_INTERNAL
 void spice_msg_out_send(SpiceMsgOut *out)
 {
     g_return_if_fail(out != NULL);
+    g_return_if_fail(out->channel != NULL);
 
-    spice_channel_send_msg(out->channel, out, TRUE);
+    g_queue_push_tail(&out->channel->priv->xmit_queue, out);
 
     /* TODO: we currently flush/wakeup immediately all buffered messages */
     spice_channel_wakeup(out->channel);
@@ -552,7 +553,7 @@ void spice_msg_out_send_internal(SpiceMsgOut *out)
 {
     g_return_if_fail(out != NULL);
 
-    spice_channel_send_msg(out->channel, out, FALSE);
+    spice_channel_write_msg(out->channel, out);
 }
 
 /* ---------------------------------------------------------------- */
@@ -1567,22 +1568,6 @@ gboolean spice_channel_get_read_only(SpiceChannel *channel)
     return spice_session_get_read_only(channel->priv->session);
 }
 
-/* coroutine context if @buffered is FALSE,
-   system context if @buffered is TRUE */
-static void spice_channel_send_msg(SpiceChannel *channel, SpiceMsgOut *out, gboolean buffered)
-{
-    SpiceChannelPrivate *c = channel->priv;
-
-    g_return_if_fail(channel != NULL);
-    g_return_if_fail(out != NULL);
-
-    if (buffered) {
-        g_queue_push_tail(&c->xmit_queue, out);
-    } else {
-        spice_channel_write_msg(channel, out);
-    }
-}
-
 /* coroutine context */
 G_GNUC_INTERNAL
 void spice_channel_recv_msg(SpiceChannel *channel,
-- 
1.7.7.4



More information about the Spice-devel mailing list