From a49d9401803c068c5fccc068b069e1621f5904a4 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 16 Oct 2014 15:57:02 +0100 Subject: [PATCH 4/8] dbus-daemon: log abnormal disconnections --- bus/connection.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/bus/connection.c b/bus/connection.c index 519122c..cfe8f9e 100644 --- a/bus/connection.c +++ b/bus/connection.c @@ -193,10 +193,27 @@ bus_connection_disconnected (DBusConnection *connection) BusConnectionData *d; BusService *service; BusMatchmaker *matchmaker; - + DBusError error; + d = BUS_CONNECTION_DATA (connection); _dbus_assert (d != NULL); + dbus_error_init (&error); + + if (!_dbus_connection_check_connected (connection, &error)) + { + if (strcmp (error.name, DBUS_ERROR_DISCONNECTED) != 0) + { + bus_context_log (d->connections->context, + DBUS_SYSTEM_LOG_INFO, + "Connection %s disconnected abnormally: %s: %s", + d->name ? d->name : "(inactive)", + error.name, error.message); + } + + dbus_error_free (&error); + } + _dbus_verbose ("%s disconnected, dropping all service ownership and releasing\n", d->name ? d->name : "(inactive)"); -- 2.1.1