dbus/dbus dbus-auth.c, 1.44, 1.45 dbus-connection-internal.h, 1.24, 1.25 dbus-connection.c, 1.110, 1.111 dbus-keyring.c, 1.29, 1.30 dbus-timeout.c, 1.14, 1.15 dbus-transport-unix.c, 1.46, 1.47

Mark McLoughlin mark at freedesktop.org
Sun Sep 11 03:02:49 PDT 2005


Update of /cvs/dbus/dbus/dbus
In directory gabe:/tmp/cvs-serv30632/dbus

Modified Files:
	dbus-auth.c dbus-connection-internal.h dbus-connection.c 
	dbus-keyring.c dbus-timeout.c dbus-transport-unix.c 
Log Message:
2005-09-11  Mark McLoughlin  <mark at skynet.ie>

	* test/data/auth/fallback.auth-script: we don't
	retry the EXTERNAL method when we know its going
	to fail anymore.

2005-09-11  Mark McLoughlin  <mark at skynet.ie>

	* dbus/dbus-connection-internal.h: rename
	(add|remove|toggle)_(watch|timeout) to unlocked()
	
	* dbus/dbus-connection.c: ditto.
	
	* dbus/dbus-timeout.c, dbus/dbus-transport-unix.c:
	Update some callers for the renaming.

2005-09-10  Mark McLoughlin  <mark at skynet.ie>

	* dbus/dbus-auth.c: (record_mechanisms): don't
	retry the first auth mechanism because we know
	we're just going to get rejected again.
	
	* dbus/dbus-keyring.c: (_dbus_keyring_reload):
	Fix thinko ... and what a nasty little bugger to
	track down you were ...

	* dbus/dbus-connection.c:
	(_dbus_connection_add_watch),
	(_dbus_connection_remove_watch): add note about
	these needing the connection to be locked.
	(_dbus_connection_get_dispatch_status_unlocked):
	set status to DATA_REMAINS when we queue the
	disconnected message.
	
	* bus/dispatch.c:
	(bus_dispatch): fix warning.
	(check_existent_service_no_auto_start):
	Expect ChildSignaled error too.
	(check_existent_hello_from_self): fix another
	couple of warnings.
	


Index: dbus-auth.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-auth.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- dbus-auth.c	1 Aug 2005 18:59:02 -0000	1.44
+++ dbus-auth.c	11 Sep 2005 10:02:47 -0000	1.45
@@ -1668,14 +1668,22 @@
            * it lists things in that order anyhow.
            */
 
-          _dbus_verbose ("%s: Adding mechanism %s to list we will try\n",
-                         DBUS_AUTH_NAME (auth), mech->mechanism);
+          if (mech != &all_mechanisms[0])
+            {
+              _dbus_verbose ("%s: Adding mechanism %s to list we will try\n",
+                             DBUS_AUTH_NAME (auth), mech->mechanism);
           
-          if (!_dbus_list_append (& DBUS_AUTH_CLIENT (auth)->mechs_to_try,
-                                  (void*) mech))
+              if (!_dbus_list_append (& DBUS_AUTH_CLIENT (auth)->mechs_to_try,
+                                      (void*) mech))
+                {
+                  _dbus_string_free (&m);
+                  goto nomem;
+                }
+            }
+          else
             {
-              _dbus_string_free (&m);
-              goto nomem;
+              _dbus_verbose ("%s: Already tried mechanism %s; not adding to list we will try\n",
+                             DBUS_AUTH_NAME (auth), mech->mechanism);
             }
         }
       else

Index: dbus-connection-internal.h
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-connection-internal.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- dbus-connection-internal.h	16 Feb 2005 04:37:27 -0000	1.24
+++ dbus-connection-internal.h	11 Sep 2005 10:02:47 -0000	1.25
@@ -56,21 +56,21 @@
 DBusMessage*      _dbus_connection_get_message_to_send         (DBusConnection     *connection);
 void              _dbus_connection_message_sent                (DBusConnection     *connection,
                                                                 DBusMessage        *message);
-dbus_bool_t       _dbus_connection_add_watch                   (DBusConnection     *connection,
+dbus_bool_t       _dbus_connection_add_watch_unlocked          (DBusConnection     *connection,
                                                                 DBusWatch          *watch);
-void              _dbus_connection_remove_watch                (DBusConnection     *connection,
+void              _dbus_connection_remove_watch_unlocked       (DBusConnection     *connection,
                                                                 DBusWatch          *watch);
-void              _dbus_connection_toggle_watch                (DBusConnection     *connection,
+void              _dbus_connection_toggle_watch_unlocked       (DBusConnection     *connection,
                                                                 DBusWatch          *watch,
                                                                 dbus_bool_t         enabled);
 dbus_bool_t       _dbus_connection_handle_watch                (DBusWatch          *watch,
                                                                 unsigned int        condition,
                                                                 void               *data);
-dbus_bool_t       _dbus_connection_add_timeout                 (DBusConnection     *connection,
+dbus_bool_t       _dbus_connection_add_timeout_unlocked        (DBusConnection     *connection,
                                                                 DBusTimeout        *timeout);
-void              _dbus_connection_remove_timeout              (DBusConnection     *connection,
+void              _dbus_connection_remove_timeout_unlocked     (DBusConnection     *connection,
                                                                 DBusTimeout        *timeout);
-void              _dbus_connection_toggle_timeout              (DBusConnection     *connection,
+void              _dbus_connection_toggle_timeout_unlocked     (DBusConnection     *connection,
                                                                 DBusTimeout        *timeout,
                                                                 dbus_bool_t         enabled);
 DBusConnection*   _dbus_connection_new_for_transport           (DBusTransport      *transport);

Index: dbus-connection.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-connection.c,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -d -r1.110 -r1.111
--- dbus-connection.c	26 Aug 2005 17:34:59 -0000	1.110
+++ dbus-connection.c	11 Sep 2005 10:02:47 -0000	1.111
@@ -377,8 +377,8 @@
       if (pending != NULL)
 	{
 	  if (pending->timeout_added)
-	    _dbus_connection_remove_timeout (connection,
-                                             pending->timeout);
+            _dbus_connection_remove_timeout_unlocked (connection,
+                                                      pending->timeout);
 
 	  pending->timeout_added = FALSE;
 	}
@@ -594,14 +594,15 @@
  * available. Otherwise records the watch to be added when said
  * function is available. Also re-adds the watch if the
  * DBusAddWatchFunction changes. May fail due to lack of memory.
+ * Connection lock should be held when calling this.
  *
  * @param connection the connection.
  * @param watch the watch to add.
  * @returns #TRUE on success.
  */
 dbus_bool_t
-_dbus_connection_add_watch (DBusConnection *connection,
-                            DBusWatch      *watch)
+_dbus_connection_add_watch_unlocked (DBusConnection *connection,
+                                     DBusWatch      *watch)
 {
   return protected_change_watch (connection, watch,
                                  _dbus_watch_list_add_watch,
@@ -612,13 +613,14 @@
  * Removes a watch using the connection's DBusRemoveWatchFunction
  * if available. It's an error to call this function on a watch
  * that was not previously added.
+ * Connection lock should be held when calling this.
  *
  * @param connection the connection.
  * @param watch the watch to remove.
  */
 void
-_dbus_connection_remove_watch (DBusConnection *connection,
-                               DBusWatch      *watch)
+_dbus_connection_remove_watch_unlocked (DBusConnection *connection,
+                                        DBusWatch      *watch)
 {
   protected_change_watch (connection, watch,
                           NULL,
@@ -637,9 +639,9 @@
  * @param enabled whether to enable or disable
  */
 void
-_dbus_connection_toggle_watch (DBusConnection *connection,
-                               DBusWatch      *watch,
-                               dbus_bool_t     enabled)
+_dbus_connection_toggle_watch_unlocked (DBusConnection *connection,
+                                        DBusWatch      *watch,
+                                        dbus_bool_t     enabled)
 {
   _dbus_assert (watch != NULL);
 
@@ -710,14 +712,15 @@
  * function is available. Also re-adds the timeout if the
  * DBusAddTimeoutFunction changes. May fail due to lack of memory.
  * The timeout will fire repeatedly until removed.
+ * Connection lock should be held when calling this.
  *
  * @param connection the connection.
  * @param timeout the timeout to add.
  * @returns #TRUE on success.
  */
 dbus_bool_t
-_dbus_connection_add_timeout (DBusConnection *connection,
-			      DBusTimeout    *timeout)
+_dbus_connection_add_timeout_unlocked (DBusConnection *connection,
+                                       DBusTimeout    *timeout)
 {
   return protected_change_timeout (connection, timeout,
                                    _dbus_timeout_list_add_timeout,
@@ -728,13 +731,14 @@
  * Removes a timeout using the connection's DBusRemoveTimeoutFunction
  * if available. It's an error to call this function on a timeout
  * that was not previously added.
+ * Connection lock should be held when calling this.
  *
  * @param connection the connection.
  * @param timeout the timeout to remove.
  */
 void
-_dbus_connection_remove_timeout (DBusConnection *connection,
-				 DBusTimeout    *timeout)
+_dbus_connection_remove_timeout_unlocked (DBusConnection *connection,
+                                          DBusTimeout    *timeout)
 {
   protected_change_timeout (connection, timeout,
                             NULL,
@@ -746,15 +750,16 @@
  * Toggles a timeout and notifies app via connection's
  * DBusTimeoutToggledFunction if available. It's an error to call this
  * function on a timeout that was not previously added.
+ * Connection lock should be held when calling this.
  *
  * @param connection the connection.
  * @param timeout the timeout to toggle.
  * @param enabled whether to enable or disable
  */
 void
-_dbus_connection_toggle_timeout (DBusConnection   *connection,
-                                 DBusTimeout      *timeout,
-                                 dbus_bool_t       enabled)
+_dbus_connection_toggle_timeout_unlocked (DBusConnection   *connection,
+                                          DBusTimeout      *timeout,
+                                          dbus_bool_t       enabled)
 {
   protected_change_timeout (connection, timeout,
                             NULL, NULL,
@@ -770,14 +775,14 @@
   
   _dbus_assert (pending->reply_serial != 0);
 
-  if (!_dbus_connection_add_timeout (connection, pending->timeout))
+  if (!_dbus_connection_add_timeout_unlocked (connection, pending->timeout))
     return FALSE;
   
   if (!_dbus_hash_table_insert_int (connection->pending_replies,
                                     pending->reply_serial,
                                     pending))
     {
-      _dbus_connection_remove_timeout (connection, pending->timeout);
+      _dbus_connection_remove_timeout_unlocked (connection, pending->timeout);
 
       HAVE_LOCK_CHECK (connection);
       return FALSE;
@@ -807,8 +812,8 @@
     {
       if (pending->timeout_added)
         {
-          _dbus_connection_remove_timeout (pending->connection,
-                                           pending->timeout);
+          _dbus_connection_remove_timeout_unlocked (pending->connection,
+                                                    pending->timeout);
           pending->timeout_added = FALSE;
         }
 
@@ -2353,8 +2358,8 @@
       pending->timeout_link = NULL;
     }
 
-  _dbus_connection_remove_timeout (connection,
-				   pending->timeout);
+  _dbus_connection_remove_timeout_unlocked (connection,
+				            pending->timeout);
   pending->timeout_added = FALSE;
 
   _dbus_verbose ("%s middle\n", _DBUS_FUNCTION_NAME);
@@ -3264,6 +3269,8 @@
               _dbus_connection_queue_synthesized_message_link (connection,
                                                                connection->disconnect_message_link);
               connection->disconnect_message_link = NULL;
+
+              status = DBUS_DISPATCH_DATA_REMAINS;
             }
 
           /* Dump the outgoing queue, we aren't going to be able to

Index: dbus-keyring.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-keyring.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- dbus-keyring.c	6 Sep 2005 22:38:54 -0000	1.29
+++ dbus-keyring.c	11 Sep 2005 10:02:47 -0000	1.30
@@ -482,7 +482,7 @@
       DBusKey *new;
 
       /* Don't load more than the max. */
-      if (n_keys >= (add_new ? MAX_KEYS_IN_FILE : MAX_KEYS_IN_FILE - 1))
+      if (n_keys >= (add_new ? MAX_KEYS_IN_FILE - 1 : MAX_KEYS_IN_FILE))
         break;
       
       next = 0;

Index: dbus-timeout.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-timeout.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- dbus-timeout.c	10 Aug 2004 03:07:00 -0000	1.14
+++ dbus-timeout.c	11 Sep 2005 10:02:47 -0000	1.15
@@ -123,8 +123,8 @@
 /**
  * Changes the timeout interval. Note that you have to disable and
  * re-enable the timeout using the timeout toggle function
- * (_dbus_connection_toggle_timeout() etc.) to notify the application
- * of this change.
+ * (_dbus_connection_toggle_timeout_unlocked() etc.) to notify the
+ * application of this change.
  *
  * @param timeout the timeout
  * @param interval the new interval
@@ -140,7 +140,7 @@
 
 /**
  * Changes the timeout's enabled-ness. Note that you should use
- * _dbus_connection_toggle_timeout() etc. instead, if
+ * _dbus_connection_toggle_timeout_unlocked() etc. instead, if
  * the timeout is passed out to an application main loop.
  * i.e. you can't use this function in the D-BUS library, it's
  * only used in the message bus daemon implementation.

Index: dbus-transport-unix.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-transport-unix.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- dbus-transport-unix.c	26 Feb 2005 06:37:46 -0000	1.46
+++ dbus-transport-unix.c	11 Sep 2005 10:02:47 -0000	1.47
@@ -76,8 +76,8 @@
   if (unix_transport->read_watch)
     {
       if (transport->connection)
-        _dbus_connection_remove_watch (transport->connection,
-                                       unix_transport->read_watch);
+        _dbus_connection_remove_watch_unlocked (transport->connection,
+                                                unix_transport->read_watch);
       _dbus_watch_invalidate (unix_transport->read_watch);
       _dbus_watch_unref (unix_transport->read_watch);
       unix_transport->read_watch = NULL;
@@ -86,8 +86,8 @@
   if (unix_transport->write_watch)
     {
       if (transport->connection)
-        _dbus_connection_remove_watch (transport->connection,
-                                       unix_transport->write_watch);
+        _dbus_connection_remove_watch_unlocked (transport->connection,
+                                                unix_transport->write_watch);
       _dbus_watch_invalidate (unix_transport->write_watch);
       _dbus_watch_unref (unix_transport->write_watch);
       unix_transport->write_watch = NULL;
@@ -162,9 +162,9 @@
                  unix_transport->fd,
                  _dbus_connection_has_messages_to_send_unlocked (transport->connection));
 
-  _dbus_connection_toggle_watch (transport->connection,
-                                 unix_transport->write_watch,
-                                 needed);
+  _dbus_connection_toggle_watch_unlocked (transport->connection,
+                                          unix_transport->write_watch,
+                                          needed);
 
   _dbus_transport_unref (transport);
 }
@@ -222,9 +222,9 @@
     }
 
   _dbus_verbose ("  setting read watch enabled = %d\n", need_read_watch);
-  _dbus_connection_toggle_watch (transport->connection,
-                                 unix_transport->read_watch,
-                                 need_read_watch);
+  _dbus_connection_toggle_watch_unlocked (transport->connection,
+                                          unix_transport->read_watch,
+                                          need_read_watch);
 
   _dbus_transport_unref (transport);
 }
@@ -899,15 +899,15 @@
                            _dbus_connection_handle_watch,
                            transport->connection, NULL);
   
-  if (!_dbus_connection_add_watch (transport->connection,
-                                   unix_transport->write_watch))
+  if (!_dbus_connection_add_watch_unlocked (transport->connection,
+                                            unix_transport->write_watch))
     return FALSE;
 
-  if (!_dbus_connection_add_watch (transport->connection,
-                                   unix_transport->read_watch))
+  if (!_dbus_connection_add_watch_unlocked (transport->connection,
+                                            unix_transport->read_watch))
     {
-      _dbus_connection_remove_watch (transport->connection,
-                                     unix_transport->write_watch);
+      _dbus_connection_remove_watch_unlocked (transport->connection,
+                                              unix_transport->write_watch);
       return FALSE;
     }
 



More information about the dbus-commit mailing list