From 0c506f200a60124197e8c20507a86516bb950ec4 Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Thu, 17 Jun 2010 16:09:12 -0400 Subject: [PATCH] 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 --- gio/gdbusprivate.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gio/gdbusprivate.c b/gio/gdbusprivate.c index 51e8e798c..ed1ece95b 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;