[Spice-devel] [PATCH spice-gtk 8/9] spice-channel: Move read only check to spice_channel_write_msg()

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


This is a preparation patch for removing spice_channel_send_msg().

Note that this means that buffered writes won't get checked until they are
actually send by the co-routine.

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

diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
index 08b8d4b..9c9e444 100644
--- a/gtk/spice-channel.c
+++ b/gtk/spice-channel.c
@@ -690,6 +690,12 @@ static void spice_channel_write_msg(SpiceChannel *channel, SpiceMsgOut *out)
     g_return_if_fail(out != NULL);
     g_return_if_fail(channel == out->channel);
 
+    if (out->ro_check &&
+        spice_channel_get_read_only(channel)) {
+        g_warning("Try to send message while read-only. Please report a bug.");
+        return;
+    }
+
     out->header->size =
         spice_marshaller_get_total_size(out->marshaller) - sizeof(SpiceDataHeader);
     data = spice_marshaller_linearize(out->marshaller, 0, &len, &free_data);
@@ -1570,12 +1576,6 @@ static void spice_channel_send_msg(SpiceChannel *channel, SpiceMsgOut *out, gboo
     g_return_if_fail(channel != NULL);
     g_return_if_fail(out != NULL);
 
-    if (out->ro_check &&
-        spice_channel_get_read_only(channel)) {
-        g_warning("Try to send message while read-only. Please report a bug.");
-        return;
-    }
-
     if (buffered) {
         g_queue_push_tail(&c->xmit_queue, out);
     } else {
-- 
1.7.7.4



More information about the Spice-devel mailing list