]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
* dbus/dbus-connection.c (_dbus_connection_peer_filter): New method
authorJohn (J5) Palmieri <johnp@redhat.com>
Wed, 15 Jun 2005 16:20:28 +0000 (16:20 +0000)
committerJohn (J5) Palmieri <johnp@redhat.com>
Wed, 15 Jun 2005 16:20:28 +0000 (16:20 +0000)
        (_dbus_connection_run_builtin_filters): New method
        (dbus_connection_dispatch): Run the builtin filters which in turn
        runs the peer filter which handles Ping messages.

        * doc/TODO:
         - Ping isn't handled: This patch fixes it

         - Add a test case for the Ping message: added TODO item

ChangeLog
dbus/dbus-connection.c
doc/TODO

index 9875c600d51c8398ae86ce013c4cb9460d4eefec..324f7b5c7f76c908ca4e295de7b64b46e25561ed 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2005-06-15  John (J5) Palmieri  <johnp@redhat.com>
+
+       * dbus/dbus-connection.c (_dbus_connection_peer_filter): New method 
+       (_dbus_connection_run_builtin_filters): New method
+       (dbus_connection_dispatch): Run the builtin filters which in turn
+       runs the peer filter which handles Ping messages.
+
+       * doc/TODO: 
+        - Ping isn't handled: This patch fixes it
+        
+        - Add a test case for the Ping message: added TODO item
+
 2005-06-15  John (J5) Palmieri  <johnp@redhat.com>
 
        * dbus/dbus-message.c:
index b2bc6a73be430ab8e477b2bf862db6a6d989be56..10a2d0f281eab57c0b81afda88cc5bec5d919d6b 100644 (file)
@@ -3361,6 +3361,53 @@ dbus_connection_get_dispatch_status (DBusConnection *connection)
   return status;
 }
 
+/**
+* Filter funtion for handling the Peer standard interface
+**/
+static DBusHandlerResult
+_dbus_connection_peer_filter (DBusConnection *connection,
+                              DBusMessage    *message)
+{
+  if (dbus_message_is_method_call (message,
+                                   DBUS_INTERFACE_PEER,
+                                   "Ping"))
+    {
+      DBusMessage *ret;
+      dbus_bool_t sent;
+      
+      ret = dbus_message_new_method_return (message);
+      if (ret == NULL)
+        return DBUS_HANDLER_RESULT_NEED_MEMORY;
+      
+      sent = dbus_connection_send (connection, ret, NULL);
+      dbus_message_unref (ret);
+
+      if (!sent)
+        return DBUS_HANDLER_RESULT_NEED_MEMORY;
+      
+      return DBUS_HANDLER_RESULT_HANDLED;
+    }
+                                   
+  
+  return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+}
+
+/**
+* Processes all builtin filter functions
+*
+* If the spec specifies a standard interface
+* they should be processed from this method
+**/
+static DBusHandlerResult
+_dbus_connection_run_builtin_filters (DBusConnection *connection,
+                                      DBusMessage    *message)
+{
+  /* We just run one filter for now but have the option to run more
+     if the spec calls for it in the future */
+
+  return _dbus_connection_peer_filter (connection, message);
+}
+
 /**
  * Processes data buffered while handling watches, queueing zero or
  * more incoming messages. Then pops the first-received message from
@@ -3469,7 +3516,11 @@ dbus_connection_dispatch (DBusConnection *connection)
       result = DBUS_HANDLER_RESULT_HANDLED;
       goto out;
     }
-  
+  result = _dbus_connection_run_builtin_filters (connection, message);
+  if (result != DBUS_HANDLER_RESULT_NOT_YET_HANDLED)
+    goto out;
   if (!_dbus_list_copy (&connection->filter_list, &filter_list_copy))
     {
       _dbus_connection_release_dispatch (connection);
index 7eedcd4ac7d7a689d57c5272a0e40ee0a0260e7a..e88d78f2f495c979fe7e8cf8d0a7c82097ff4973 100644 (file)
--- a/doc/TODO
+++ b/doc/TODO
@@ -18,16 +18,13 @@ Important for 1.0
 
  - just before 1.0, try a HAVE_INT64=0 build and be sure it runs
 
- - in dbus-keyring.c, enforce that the keyring dir is not 
-   world readable/writable
-
- - Ping isn't handled
-
  - dbus-pending-call.c has some API and thread safety issues to review
 
  - Add test harness for selinux allow/deny cf. this message
    http://lists.freedesktop.org/archives/dbus/2005-April/002506.html
 
+ - Add a test case for handling the Ping message 
+
 Important for 1.0 GLib Bindings
 ===