]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
2003-08-11 Havoc Pennington <hp@pobox.com>
authorHavoc Pennington <hp@redhat.com>
Tue, 12 Aug 2003 02:43:50 +0000 (02:43 +0000)
committerHavoc Pennington <hp@redhat.com>
Tue, 12 Aug 2003 02:43:50 +0000 (02:43 +0000)
* bus/test.c (client_disconnect_handler): change to return
HANDLED (would have been REMOVE_MESSAGE)

* dbus/dbus-object.h (enum DBusHandlerResult): rename to
HANDLED/NOT_YET_HANDLED instead of
REMOVE_MESSAGE/ALLOW_MORE_HANDLERS to make it clearer how it
should be used.

ChangeLog
bus/dispatch.c
bus/test.c
dbus/dbus-connection.c
dbus/dbus-message-handler.c
dbus/dbus-object-registry.c
dbus/dbus-object.h
glib/test-profile.c
glib/test-thread-server.c
test/test-service.c
tools/dbus-monitor.c

index 0473f388e73f5d4972aed21562d3845c277a94d4..b786b4ec7d8741cd339edac7c2d0e9ab6d95e68a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2003-08-11  Havoc Pennington  <hp@pobox.com>
+
+       * bus/test.c (client_disconnect_handler): change to return
+       HANDLED (would have been REMOVE_MESSAGE)
+
+       * dbus/dbus-object.h (enum DBusHandlerResult): rename to
+       HANDLED/NOT_YET_HANDLED instead of
+       REMOVE_MESSAGE/ALLOW_MORE_HANDLERS to make it clearer how it 
+       should be used.
+
 2003-08-10  Havoc Pennington  <hp@pobox.com>
 
        * tools/dbus-send.c (main): add --type argument, for now
index f4d19dcf423c90e6f0cf4c00852f2e4e39bc4e52..6902da65c0fd7d29dad62b41e121cbb56a89e0b7 100644 (file)
@@ -305,7 +305,7 @@ bus_dispatch_message_handler (DBusMessageHandler *handler,
 {
   bus_dispatch (connection, message);
   
-  return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+  return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 }
 
 static void
index ca10422f3065bc0de52370b8018f17a2fa52a378..d28d7edf1d76a689cc1e8cc7f048c73af4f590cd 100644 (file)
@@ -109,7 +109,7 @@ client_disconnect_handler (DBusMessageHandler *handler,
 {
   if (!dbus_message_has_name (message,
                               DBUS_MESSAGE_LOCAL_DISCONNECT))
-    return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+    return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
     
   _dbus_verbose ("Removing client %p in disconnect handler\n",
                  connection);
@@ -124,7 +124,7 @@ client_disconnect_handler (DBusMessageHandler *handler,
       client_loop = NULL;
     }
   
-  return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+  return DBUS_HANDLER_RESULT_HANDLED;
 }
 
 static dbus_int32_t handler_slot = -1;
index d30ccb0a603424c348cdf77d8ef385fefd9c6ae8..17563f3537bf851f109aebb3ceddd635616b1224 100644 (file)
@@ -2306,7 +2306,7 @@ dbus_connection_dispatch (DBusConnection *connection)
 
   message = message_link->data;
   
-  result = DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+  result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 
   reply_serial = dbus_message_get_reply_serial (message);
   reply_handler_data = _dbus_hash_table_lookup_int (connection->pending_replies,
@@ -2346,7 +2346,7 @@ dbus_connection_dispatch (DBusConnection *connection)
       result = _dbus_message_handler_handle_message (handler, connection,
                                                      message);
 
-      if (result != DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS)
+      if (result != DBUS_HANDLER_RESULT_NOT_YET_HANDLED)
        break;
 
       link = next;
@@ -2363,7 +2363,7 @@ dbus_connection_dispatch (DBusConnection *connection)
     /* FIXME */ ;
   
   /* Did a reply we were waiting on get filtered? */
-  if (reply_handler_data && result == DBUS_HANDLER_RESULT_REMOVE_MESSAGE)
+  if (reply_handler_data && result == DBUS_HANDLER_RESULT_HANDLED)
     {
       /* Queue the timeout immediately! */
       if (reply_handler_data->timeout_link)
@@ -2379,7 +2379,7 @@ dbus_connection_dispatch (DBusConnection *connection)
        }
     }
   
-  if (result == DBUS_HANDLER_RESULT_REMOVE_MESSAGE)
+  if (result == DBUS_HANDLER_RESULT_HANDLED)
     goto out;
   
   if (reply_handler_data)
@@ -2405,7 +2405,7 @@ dbus_connection_dispatch (DBusConnection *connection)
                                                     message);
   
   CONNECTION_LOCK (connection);
-  if (result == DBUS_HANDLER_RESULT_REMOVE_MESSAGE)
+  if (result == DBUS_HANDLER_RESULT_HANDLED)
     goto out;
 
   if (result == DBUS_HANDLER_RESULT_NEED_MEMORY)
index 8bb4dd1861bf4225df3cce00829d8f794dd0207a..2e8a8b64199d5628d2f949a75dba917106fa5e02 100644 (file)
@@ -130,7 +130,7 @@ _dbus_message_handler_handle_message (DBusMessageHandler        *handler,
   if (function != NULL)
     return (* function) (handler, connection, message, user_data);
   else
-    return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+    return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 }
 
 /** @} */
@@ -315,7 +315,7 @@ test_handler (DBusMessageHandler *handler,
               DBusMessage        *message,
               void               *user_data)
 {
-  return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+  return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 }
 
 static void
index f86a365f532ac3438d1033bbe74c099035392cad..f1aa27de0b649ddb3421380286084901fc303e9b 100644 (file)
@@ -705,7 +705,7 @@ handle_method_call_and_unlock (DBusObjectRegistry *registry,
 #endif
         _dbus_connection_unlock (registry->connection);
 
-      return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+      return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
     }
   
   _dbus_assert (iface_entry->n_objects > 0);
@@ -729,7 +729,7 @@ handle_method_call_and_unlock (DBusObjectRegistry *registry,
   
   (* vtable->message) (&info, message);
 
-  return DBUS_HANDLER_RESULT_REMOVE_MESSAGE;
+  return DBUS_HANDLER_RESULT_HANDLED;
 }
 
 typedef struct
@@ -760,7 +760,7 @@ handle_signal_and_unlock (DBusObjectRegistry *registry,
 #endif
         _dbus_connection_unlock (registry->connection);
       
-      return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+      return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
     }
   
   _dbus_assert (signal_entry->n_connections > 0);
@@ -865,7 +865,7 @@ handle_signal_and_unlock (DBusObjectRegistry *registry,
 #endif
     _dbus_connection_unlock (registry->connection);
 
-  return DBUS_HANDLER_RESULT_REMOVE_MESSAGE;
+  return DBUS_HANDLER_RESULT_HANDLED;
 }
 
 /**
@@ -902,7 +902,7 @@ _dbus_object_registry_handle_and_unlock (DBusObjectRegistry *registry,
 #endif
         _dbus_connection_unlock (registry->connection);
 
-      return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+      return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
     }
 }
 
@@ -1202,7 +1202,8 @@ add_and_remove_objects (DBusObjectRegistry *registry)
       callback = dbus_callback_object_new (noop_message_function, NULL, NULL);
       if (callback == NULL)
         goto out;
-      
+
+      interfaces = NULL;
       switch (i % 3)
         {
         case 0:
@@ -1215,6 +1216,7 @@ add_and_remove_objects (DBusObjectRegistry *registry)
           interfaces = three_interfaces;
           break;
         }
+      _dbus_assert (interfaces != NULL);
       
       if (!_dbus_object_registry_add_and_unlock (registry,
                                                  interfaces,
@@ -1255,7 +1257,8 @@ add_and_remove_objects (DBusObjectRegistry *registry)
           callback = dbus_callback_object_new (noop_message_function, NULL, NULL);
           if (callback == NULL)
             goto out;
-          
+
+          interfaces = NULL;
           switch (i % 4)
             {
             case 0:
@@ -1271,6 +1274,7 @@ add_and_remove_objects (DBusObjectRegistry *registry)
               interfaces = three_interfaces;
               break;
             }
+          _dbus_assert (interfaces != NULL);
       
           if (!_dbus_object_registry_add_and_unlock (registry,
                                                      interfaces,
@@ -1292,7 +1296,7 @@ add_and_remove_objects (DBusObjectRegistry *registry)
   if (message != NULL)
     {
       if (_dbus_object_registry_handle_and_unlock (registry, message) !=
-          DBUS_HANDLER_RESULT_REMOVE_MESSAGE)
+          DBUS_HANDLER_RESULT_HANDLED)
         _dbus_assert_not_reached ("message not handled\n");
       dbus_message_unref (message);
     }
@@ -1301,7 +1305,7 @@ add_and_remove_objects (DBusObjectRegistry *registry)
   if (message != NULL)
     {
       if (_dbus_object_registry_handle_and_unlock (registry, message) !=
-          DBUS_HANDLER_RESULT_REMOVE_MESSAGE)
+          DBUS_HANDLER_RESULT_HANDLED)
         _dbus_assert_not_reached ("message not handled\n");
       dbus_message_unref (message);
     }
@@ -1310,7 +1314,7 @@ add_and_remove_objects (DBusObjectRegistry *registry)
   if (message != NULL)
     {
       if (_dbus_object_registry_handle_and_unlock (registry, message) !=
-          DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS)
+          DBUS_HANDLER_RESULT_NOT_YET_HANDLED)
         _dbus_assert_not_reached ("message handled but no handler was registered\n");
       dbus_message_unref (message);
     }
index 76d0e6f6f240818f6d97074570d70e27c3b6b38f..23c12d15b10f57458306068cf57dfebe975c79b1 100644 (file)
@@ -41,8 +41,8 @@ typedef struct DBusCallbackObject DBusCallbackObject;
 
 typedef enum
 {
-  DBUS_HANDLER_RESULT_REMOVE_MESSAGE,      /**< Remove this message, no further processing. */
-  DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS, /**< Run any additional handlers that are interested in this message. */
+  DBUS_HANDLER_RESULT_HANDLED,             /**< Remove this message, no further processing. */
+  DBUS_HANDLER_RESULT_NOT_YET_HANDLED,     /**< Run any additional handlers that are interested in this message. */
   DBUS_HANDLER_RESULT_NEED_MEMORY          /**< Need more memory to handle this message. */
 } DBusHandlerResult;
 
index 6d13e32faf86eb60edb7e2b9e5ed5f99a29b5d34..852bd091935218d76c707f0a6804767f72dca115 100644 (file)
@@ -76,9 +76,10 @@ client_filter (DBusMessageHandler *handler,
           exit (0);
         }
       send_echo_message (connection);
+      return DBUS_HANDLER_RESULT_HANDLED;
     }
   
-  return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+  return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 }
 
 static void*
@@ -147,9 +148,10 @@ server_filter (DBusMessageHandler *handler,
                                   ECHO_MESSAGE))
     {
       send_echo_message (connection);
+      return DBUS_HANDLER_RESULT_HANDLED;
     }
   
-  return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+  return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 }
 
 static void
index 4cc886fdd2b95a6eb1c7912a1869b306b2b8edb3..3ad1f907f4ebedf5cb0ec112f5b2a4003ad56c2d 100644 (file)
@@ -44,7 +44,7 @@ handle_test_message (DBusMessageHandler *handler,
   int i;
 
   if (!dbus_message_has_name (message, "org.freedesktop.ThreadTest"))
-    return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+    return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
   
   dbus_message_iter_init (message, &iter);
   
@@ -127,7 +127,7 @@ handle_test_message (DBusMessageHandler *handler,
   g_string_free (counter_str, TRUE);
   
  out:
-  return DBUS_HANDLER_RESULT_REMOVE_MESSAGE;
+  return DBUS_HANDLER_RESULT_HANDLED;
 }
 
 static DBusHandlerResult
@@ -136,7 +136,7 @@ handle_filter (DBusMessageHandler *handler,
               DBusMessage        *message,
               void               *user_data)
 {  
-  return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+  return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 }
 
 static DBusHandlerResult
@@ -146,12 +146,12 @@ handle_disconnect (DBusMessageHandler *handler,
                    void               *user_data)
 {
   if (!dbus_message_has_name (message, DBUS_MESSAGE_LOCAL_DISCONNECT))
-    return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+    return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 
   g_print ("connection disconnected\n");
   dbus_connection_unref (connection);
   
-  return DBUS_HANDLER_RESULT_REMOVE_MESSAGE;
+  return DBUS_HANDLER_RESULT_HANDLED;
 }
 
 static void
index 0771f33ce350f116ba71b9266467c2bfcc237e20..fffe4187b3d24e67fca423bfd1f29c8e97403735 100644 (file)
@@ -49,7 +49,7 @@ handle_echo (DBusConnection     *connection,
 
       dbus_message_unref (reply);
 
-      return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+      return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
     }
 
   reply = dbus_message_new_method_return (message);
@@ -68,7 +68,7 @@ handle_echo (DBusConnection     *connection,
   
   dbus_message_unref (reply);
     
-  return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+  return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 }
 
 static DBusHandlerResult
@@ -84,11 +84,11 @@ filter_func (DBusMessageHandler *handler,
     {
       dbus_connection_disconnect (connection);
       quit ();
-      return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+      return DBUS_HANDLER_RESULT_HANDLED;
     }
   else
     {
-      return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+      return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
     }
 }
 
index dac152923d1cc4cf14a6db90242ea17b49064a1a..a0f77407dd0090ddeea9fdcdf79ebf8b088ac78e 100644 (file)
@@ -40,7 +40,7 @@ handler_func (DBusMessageHandler *handler,
   if (dbus_message_has_name (message, DBUS_MESSAGE_LOCAL_DISCONNECT))
     exit (0);
   
-  return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
+  return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 }
 
 static void