[glib] GDBus: If exiting b/c remote peer disconnected and error is set, print it



commit 6a492a45191335ac97f54785db543f21dfce379c
Author: David Zeuthen <davidz redhat com>
Date:   Tue Aug 3 12:24:48 2010 -0400

    GDBus: If exiting b/c remote peer disconnected and error is set, print it
    
    This should make things easier to debug:
    
      g_dbus_connection_real_closed: Remote peer vanished with error:
      Underlying GIOStream returned 0 bytes on an async read
      (g-io-error-quark, 0). Exiting.
    
    Signed-off-by: David Zeuthen <davidz redhat com>

 gio/gdbusconnection.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c
index b81dfb3..95fcaea 100644
--- a/gio/gdbusconnection.c
+++ b/gio/gdbusconnection.c
@@ -553,7 +553,17 @@ g_dbus_connection_real_closed (GDBusConnection *connection,
 {
   if (remote_peer_vanished && connection->exit_on_close)
     {
-      g_print ("%s: Remote peer vanished. Exiting.\n", G_STRFUNC);
+      if (error != NULL)
+        {
+          g_print ("%s: Remote peer vanished with error: %s (%s, %d). Exiting.\n",
+                   G_STRFUNC,
+                   error->message,
+                   g_quark_to_string (error->domain), error->code);
+        }
+      else
+        {
+          g_print ("%s: Remote peer vanished. Exiting.\n", G_STRFUNC);
+        }
       raise (SIGTERM);
     }
 }



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