dbus/dbus dbus-connection.c,1.107,1.108
John Palmieri
johnp at freedesktop.org
Wed Jun 15 09:20:31 PDT 2005
Update of /cvs/dbus/dbus/dbus
In directory gabe:/tmp/cvs-serv11016/dbus
Modified Files:
dbus-connection.c
Log Message:
* 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
Index: dbus-connection.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-connection.c,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -d -r1.107 -r1.108
--- dbus-connection.c 6 Jun 2005 18:55:22 -0000 1.107
+++ dbus-connection.c 15 Jun 2005 16:20:28 -0000 1.108
@@ -3362,6 +3362,53 @@
}
/**
+* 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
* the current incoming message queue, runs any handlers for it, and
@@ -3469,7 +3516,11 @@
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);
More information about the dbus-commit
mailing list