[glib] GDBus: Complain via g_warning() if an invalid message is received



commit 0c506f200a60124197e8c20507a86516bb950ec4
Author: David Zeuthen <davidz redhat com>
Date:   Thu Jun 17 16:09:12 2010 -0400

    GDBus: Complain via g_warning() if an invalid message is received
    
    While we are already propagating the error to the user via the
    GDBusConnection::disconnected signal (because the only safe thing is
    to disconnect the other peer), changes are the user is simply not
    listening to this signal.
    
    This should never ever happen unless there's a bug in the
    serializaer/deserializer so it's fine to complain via g_warning()
    here.
    
    Bug 621838, see
    
     https://bugzilla.gnome.org/show_bug.cgi?id=621838
    
    is related to this.
    
    Signed-off-by: David Zeuthen <davidz redhat com>

 gio/gdbusprivate.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/gio/gdbusprivate.c b/gio/gdbusprivate.c
index 51e8e79..ed1ece9 100644
--- a/gio/gdbusprivate.c
+++ b/gio/gdbusprivate.c
@@ -588,6 +588,16 @@ _g_dbus_worker_do_read_cb (GInputStream  *input_stream,
                                                   &error);
           if (message == NULL)
             {
+              gchar *s;
+              s = hexdump (worker->read_buffer, worker->read_buffer_cur_size, 2);
+              g_warning ("Error decoding D-Bus message of %" G_GSIZE_FORMAT " bytes\n"
+                         "The error is: %s\n"
+                         "The payload is as follows:\n"
+                         "%s\n",
+                         worker->read_buffer_cur_size,
+                         error->message,
+                         s);
+              g_free (s);
               _g_dbus_worker_emit_disconnected (worker, FALSE, error);
               g_error_free (error);
               goto out;



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