dbus/test test-service.c, 1.25, 1.26 test-shell-service.c, 1.2, 1.3 test-utils.c, 1.6, 1.7

John Palmieri johnp at kemper.freedesktop.org
Wed Sep 6 15:00:10 PDT 2006


Update of /cvs/dbus/dbus/test
In directory kemper:/tmp/cvs-serv7597/test

Modified Files:
	test-service.c test-shell-service.c test-utils.c 
Log Message:
* doc/TODO:
- Remove pending call locking todo item
- dbus_connection_open now holds hard ref.  Remove todo item
- do proper locking on _dbus_bus_check_connection_and_unref
  and handle DBUS_BUS_STARTER. Remove todo item
- Warn on closing of a shared connection.  Remove todo item

* bus/bus.c, bus/connection.c, bus/dispatch.c, dbus/dbus-bus.c,
  dbus/dbus-connection.c: Use the dbus_connection_close_internal
  so we don't get the warning when closing shared connections

* test/test-service.c, test/test-shell-service.c: Applications
  don't close shared connections themselves so we unref instead of
  close

* test/test-utils.c (test_connection_shutdown): Close the connection

* dbus/dbus-bus.c (_dbus_bus_check_connection_and_unref): Changed to
  _dbus_bus_check_connection_and_unref_unlocked since we only call this
  method on a locked connection.  
  Make sure we call _dbus_connection_unref_unlocked instead of 
  dbus_connection_unref also.
  Handle DBUS_BUS_STARTER correctly

* dbus/dbus-connection.c (connection_record_shared_unlocked):
  Mark as shared and hard ref the connection
  (connection_forget_shared_unlocked): Remove the hard ref from the 
  connection
  (_dbus_connection_close_internal_and_unlock):  New internal function
  which takes a locked connection and unlocks it after closing it
  (_dbus_connection_close_internal): New internal function which acts
  like the origonal dbus_connection_close method by grabbing a connection
  lock and calling _dbus_connection_close_internal_and_unlock
  (dbus_connection_close): Public close method, warns when the app
  trys to close a shared connection



Index: test-service.c
===================================================================
RCS file: /cvs/dbus/dbus/test/test-service.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- test-service.c	30 Aug 2006 01:27:44 -0000	1.25
+++ test-service.c	6 Sep 2006 22:00:07 -0000	1.26
@@ -115,6 +115,7 @@
   dbus_message_unref (reply);
   dbus_message_unref (echo_message);
   dbus_pending_call_unref (pcall);
+  dbus_connection_unref (connection);
 }
 
 static DBusHandlerResult
@@ -242,7 +243,7 @@
                                         "org.freedesktop.TestSuite",
                                         "Exit"))
     {
-      dbus_connection_close (connection);
+      dbus_connection_unref (connection);
       quit ();
       return DBUS_HANDLER_RESULT_HANDLED;
     }
@@ -319,7 +320,6 @@
                               DBUS_INTERFACE_LOCAL,
                               "Disconnected"))
     {
-      dbus_connection_close (connection);
       quit ();
       return DBUS_HANDLER_RESULT_HANDLED;
     }

Index: test-shell-service.c
===================================================================
RCS file: /cvs/dbus/dbus/test/test-shell-service.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- test-shell-service.c	14 Aug 2006 19:11:35 -0000	1.2
+++ test-shell-service.c	6 Sep 2006 22:00:07 -0000	1.3
@@ -85,7 +85,7 @@
                                         "org.freedesktop.TestSuite",
                                         "Exit"))
     {
-      dbus_connection_close (connection);
+      dbus_connection_unref (connection);
       quit ();
       return DBUS_HANDLER_RESULT_HANDLED;
     }
@@ -109,7 +109,6 @@
                               DBUS_INTERFACE_LOCAL,
                               "Disconnected"))
     {
-      dbus_connection_close (connection);
       quit ();
       return DBUS_HANDLER_RESULT_HANDLED;
     }

Index: test-utils.c
===================================================================
RCS file: /cvs/dbus/dbus/test/test-utils.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- test-utils.c	30 Nov 2005 19:32:26 -0000	1.6
+++ test-utils.c	6 Sep 2006 22:00:07 -0000	1.7
@@ -171,6 +171,8 @@
 test_connection_shutdown (DBusLoop       *loop,
                           DBusConnection *connection)
 {
+  _dbus_connection_close_internal (connection);
+
   if (!dbus_connection_set_watch_functions (connection,
                                             NULL,
                                             NULL,



More information about the dbus-commit mailing list