summaryrefslogtreecommitdiffstats
path: root/dbus
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@codefactory.se>2003-02-16 21:50:32 +0000
committerAnders Carlsson <andersca@codefactory.se>2003-02-16 21:50:32 +0000
commit6cf6f82faae928a9142d4aa465b5add381960e29 (patch)
tree4275653da460d9f96639e7c246f82dd1c6e233a9 /dbus
parentb2fce4c69b9fd75c54bb370e043ea166b83083f6 (diff)
2003-02-16 Anders Carlsson <andersca@codefactory.se>
* bus/dispatch.c: (send_one_message): Only send broadcast messages to registered connections. * dbus/dbus-message.c: (dbus_message_name_is): * dbus/dbus-message.h: New convenience function. * dbus/dbus-transport-debug.c: (do_reading): Only dispatch one message per run. * test/Makefile.am: * test/bus-test.c: (new_connection_callback), (die), (test_hello_client1_handler), (test_hello_client2_handler), (test_hello_replies), (main): * test/bus-test-loop.[ch]: Add these.
Diffstat (limited to 'dbus')
-rw-r--r--dbus/dbus-message.c11
-rw-r--r--dbus/dbus-message.h3
-rw-r--r--dbus/dbus-transport-debug.c15
3 files changed, 28 insertions, 1 deletions
diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c
index fced9c72..893e45f1 100644
--- a/dbus/dbus-message.c
+++ b/dbus/dbus-message.c
@@ -1735,6 +1735,17 @@ dbus_message_get_sender (DBusMessage *message)
return get_string_field (message, FIELD_SENDER, NULL);
}
+dbus_bool_t
+dbus_message_name_is (DBusMessage *message,
+ const char *name)
+{
+ if (dbus_message_get_name (message) &&
+ strcmp (dbus_message_get_name (message), name) == 0)
+ return TRUE;
+ else
+ return FALSE;
+}
+
/** @} */
/**
diff --git a/dbus/dbus-message.h b/dbus/dbus-message.h
index 2038978b..a4b93843 100644
--- a/dbus/dbus-message.h
+++ b/dbus/dbus-message.h
@@ -56,6 +56,9 @@ void dbus_message_set_is_error (DBusMessage *message,
dbus_bool_t is_error_reply);
dbus_bool_t dbus_message_get_is_error (DBusMessage *message);
+dbus_bool_t dbus_message_name_is (DBusMessage *message,
+ const char *name);
+
dbus_bool_t dbus_message_append_args (DBusMessage *message,
int first_arg_type,
...);
diff --git a/dbus/dbus-transport-debug.c b/dbus/dbus-transport-debug.c
index f829fc29..e0a90644 100644
--- a/dbus/dbus-transport-debug.c
+++ b/dbus/dbus-transport-debug.c
@@ -76,11 +76,24 @@ debug_finalize (DBusTransport *transport)
static void
do_reading (DBusTransport *transport)
{
+ DBusTransportDebug *debug_transport = (DBusTransportDebug*) transport;
+
if (transport->disconnected)
return;
/* Now dispatch the messages */
- while (dbus_connection_dispatch_message (transport->connection));
+ if (dbus_connection_dispatch_message (transport->connection))
+ {
+ debug_transport->read_timeout =
+ _dbus_timeout_new (DEFAULT_INTERVAL, (DBusTimeoutHandler)do_reading,
+ transport, NULL);
+ if (!_dbus_connection_add_timeout (transport->connection,
+ debug_transport->read_timeout))
+ {
+ _dbus_timeout_unref (debug_transport->read_timeout);
+ debug_transport->read_timeout = NULL;
+ }
+ }
}
static void