summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn (J5) Palmieri <johnp@redhat.com>2005-10-03 19:55:56 +0000
committerJohn (J5) Palmieri <johnp@redhat.com>2005-10-03 19:55:56 +0000
commit66e1cb9e68ba37980f7a90c396950be1587cdcd7 (patch)
tree689bcc7a44387e36d19a53a4b50a2d004b586a45
parent9a821f4c135b3c7b52440550660a7c1e7e4f0731 (diff)
* bus/driver.c (bus_driver_handle_introspect): Add signals
to the introspect data. (patch from Daniel P. Berrange <dan at berrange.com>) * bus/dispatch.c (check_existent_ping): Add testcase for Ping * dbus/dbus-connection.c (_dbus_connection_peer_filter, _dbus_connection_run_builtin_filters): Changed these to be unlock_no_update functions and call _dbus_connection_send_unlocked_no_update instead of dbus_connection_send to avoid locking errors. * doc/TODO: Removed the make Ping test TODO
-rw-r--r--ChangeLog16
-rw-r--r--bus/dispatch.c62
-rw-r--r--bus/driver.c39
-rw-r--r--dbus/dbus-connection.c19
-rw-r--r--doc/TODO2
5 files changed, 127 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index ab9c2e59..0c5d1fe1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2005-10-03 John (J5) Palmieri <johnp@redhat.com>
+
+ * bus/driver.c (bus_driver_handle_introspect): Add signals
+ to the introspect data. (patch from Daniel P. Berrange
+ <dan at berrange.com>)
+
+ * bus/dispatch.c (check_existent_ping): Add testcase for Ping
+
+ * dbus/dbus-connection.c (_dbus_connection_peer_filter,
+ _dbus_connection_run_builtin_filters): Changed these to
+ be unlock_no_update functions and call
+ _dbus_connection_send_unlocked_no_update instead of
+ dbus_connection_send to avoid locking errors.
+
+ * doc/TODO: Removed the make Ping test TODO
+
2005-09-26 John (J5) Palmieri <johnp@redhat.com>
* dbus/Python.pyx: Fixed memory leaks when throwing errors.
diff --git a/bus/dispatch.c b/bus/dispatch.c
index 9bb55bf1..aae7f707 100644
--- a/bus/dispatch.c
+++ b/bus/dispatch.c
@@ -2877,6 +2877,65 @@ check_existent_hello_from_self (BusContext *context,
return TRUE;
}
+/* returns TRUE if the correct thing happens,
+ * but the correct thing may include OOM errors.
+ */
+static dbus_bool_t
+check_existent_ping (BusContext *context,
+ DBusConnection *connection)
+{
+ DBusMessage *message;
+ dbus_uint32_t serial;
+ message = dbus_message_new_method_call (EXISTENT_SERVICE_NAME,
+ "/org/freedesktop/TestSuite",
+ "org.freedesktop.DBus.Peer",
+ "Ping");
+
+ if (message == NULL)
+ return TRUE;
+
+ if (!dbus_connection_send (connection, message, &serial))
+ {
+ dbus_message_unref (message);
+ return TRUE;
+ }
+
+ dbus_message_unref (message);
+ message = NULL;
+
+ bus_test_run_everything (context);
+
+ /* Note: if this test is run in OOM mode, it will block when the bus
+ * doesn't send a reply due to OOM.
+ */
+ block_connection_until_message_from_bus (context, connection, "reply from running Ping");
+
+ message = pop_message_waiting_for_memory (connection);
+ if (message == NULL)
+ {
+ _dbus_warn ("Failed to pop message! Should have been reply from Ping message\n");
+ return FALSE;
+ }
+
+ if (dbus_message_get_reply_serial (message) != serial)
+ {
+ _dbus_warn ("Wrong reply serial\n");
+ dbus_message_unref (message);
+ return FALSE;
+ }
+
+ if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_METHOD_RETURN)
+ {
+ _dbus_warn ("Unexpected message return during Ping\n");
+ dbus_message_unref (message);
+ return FALSE;
+ }
+
+ dbus_message_unref (message);
+ message = NULL;
+
+ return TRUE;
+}
/* returns TRUE if the correct thing happens,
* but the correct thing may include OOM errors.
@@ -3053,6 +3112,9 @@ check_existent_service_auto_start (BusContext *context,
dbus_message_unref (message);
message = NULL;
+ if (!check_existent_ping (context, connection))
+ goto out;
+
if (!check_existent_hello_from_self (context, connection))
goto out;
diff --git a/bus/driver.c b/bus/driver.c
index da4edaa7..9e8df517 100644
--- a/bus/driver.c
+++ b/bus/driver.c
@@ -1280,6 +1280,45 @@ bus_driver_handle_introspect (DBusConnection *connection,
++i;
}
+
+ if (!_dbus_string_append_printf (&xml, " <signal name=\"NameOwnerChanged\">\n"))
+ goto oom;
+
+ if (!_dbus_string_append_printf (&xml, " <arg type=\"s\"/>\n"))
+ goto oom;
+
+ if (!_dbus_string_append_printf (&xml, " <arg type=\"s\"/>\n"))
+ goto oom;
+
+ if (!_dbus_string_append_printf (&xml, " <arg type=\"s\"/>\n"))
+ goto oom;
+
+ if (!_dbus_string_append_printf (&xml, " </signal>\n"))
+ goto oom;
+
+
+
+ if (!_dbus_string_append_printf (&xml, " <signal name=\"NameLost\">\n"))
+ goto oom;
+
+ if (!_dbus_string_append_printf (&xml, " <arg type=\"s\"/>\n"))
+ goto oom;
+
+ if (!_dbus_string_append_printf (&xml, " </signal>\n"))
+ goto oom;
+
+
+
+ if (!_dbus_string_append_printf (&xml, " <signal name=\"NameAcquired\">\n"))
+ goto oom;
+
+ if (!_dbus_string_append_printf (&xml, " <arg type=\"s\"/>\n"))
+ goto oom;
+
+ if (!_dbus_string_append_printf (&xml, " </signal>\n"))
+ goto oom;
+
+
if (!_dbus_string_append (&xml, " </interface>\n"))
goto oom;
diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c
index ff66f5f4..1e699617 100644
--- a/dbus/dbus-connection.c
+++ b/dbus/dbus-connection.c
@@ -3363,8 +3363,8 @@ dbus_connection_get_dispatch_status (DBusConnection *connection)
* Filter funtion for handling the Peer standard interface
**/
static DBusHandlerResult
-_dbus_connection_peer_filter (DBusConnection *connection,
- DBusMessage *message)
+_dbus_connection_peer_filter_unlocked_no_update (DBusConnection *connection,
+ DBusMessage *message)
{
if (dbus_message_is_method_call (message,
DBUS_INTERFACE_PEER,
@@ -3376,8 +3376,9 @@ _dbus_connection_peer_filter (DBusConnection *connection,
ret = dbus_message_new_method_return (message);
if (ret == NULL)
return DBUS_HANDLER_RESULT_NEED_MEMORY;
-
- sent = dbus_connection_send (connection, ret, NULL);
+
+ sent = _dbus_connection_send_unlocked_no_update (connection, ret, NULL);
+
dbus_message_unref (ret);
if (!sent)
@@ -3397,13 +3398,13 @@ _dbus_connection_peer_filter (DBusConnection *connection,
* they should be processed from this method
**/
static DBusHandlerResult
-_dbus_connection_run_builtin_filters (DBusConnection *connection,
- DBusMessage *message)
+_dbus_connection_run_builtin_filters_unlocked_no_update (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);
+ return _dbus_connection_peer_filter_unlocked_no_update (connection, message);
}
/**
@@ -3514,8 +3515,8 @@ dbus_connection_dispatch (DBusConnection *connection)
result = DBUS_HANDLER_RESULT_HANDLED;
goto out;
}
-
- result = _dbus_connection_run_builtin_filters (connection, message);
+
+ result = _dbus_connection_run_builtin_filters_unlocked_no_update (connection, message);
if (result != DBUS_HANDLER_RESULT_NOT_YET_HANDLED)
goto out;
diff --git a/doc/TODO b/doc/TODO
index eba5293c..31ef3a10 100644
--- a/doc/TODO
+++ b/doc/TODO
@@ -19,8 +19,6 @@ Important for 1.0
- 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
-
- publish the introspection dtd at its URL
- RequestName flags seem a bit strange; see the docs for dbus_bus_request_name()