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>
This commit is contained in:
David Zeuthen 2010-06-17 16:09:12 -04:00
parent 57dff1e060
commit 0c506f200a

View File

@ -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;