summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-connection.c
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@codefactory.se>2003-01-28 14:26:49 +0000
committerAnders Carlsson <andersca@codefactory.se>2003-01-28 14:26:49 +0000
commitdec1fa3bd5f106ba5b2c749372231e3dd4bf9e7b (patch)
tree9a579d3d5b908ee5712249b4de696b89a72ffca7 /dbus/dbus-connection.c
parentbec3c093cab742a953e39f1726c37345873990dc (diff)
2003-01-28 Anders Carlsson <set EMAIL_ADDRESS environment variable>
* dbus/dbus-connection-internal.h: * dbus/dbus-connection.c: (_dbus_connection_add_timeout), (_dbus_connection_remove_timeout): Add functions for adding and removing timeouts. * dbus/dbus-message.c: (dbus_message_new_from_message): Add new function that takes a message and creates an exact copy of it, but with the refcount set to 1. (check_message_handling): Fix build error. * dbus/dbus-server-protected.h: * dbus/dbus-server.c: (_dbus_server_init_base), (_dbus_server_finalize_base), (_dbus_server_add_timeout), (dbus_server_set_timeout_functions): (_dbus_server_remove_timeout): New functions so that a server can add and remove timeouts. (dbus_server_listen): Add commented out call to dbus_server_debug_new. * dbus/dbus-timeout.c: (_dbus_timeout_new): Actually set the handler, doh. * dbus/dbus-transport.c: (_dbus_transport_open): Add commented out call to dbus_transport_debug_client_new. * dbus/Makefile.am: Add dbus-transport-debug.[ch] and dbus-server-debug.[ch]
Diffstat (limited to 'dbus/dbus-connection.c')
-rw-r--r--dbus/dbus-connection.c36
1 files changed, 31 insertions, 5 deletions
diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c
index be7384b2..4054f45f 100644
--- a/dbus/dbus-connection.c
+++ b/dbus/dbus-connection.c
@@ -223,6 +223,26 @@ _dbus_connection_remove_watch (DBusConnection *connection,
watch);
}
+dbus_bool_t
+_dbus_connection_add_timeout (DBusConnection *connection,
+ DBusTimeout *timeout)
+{
+ if (connection->timeouts) /* null during finalize */
+ return _dbus_timeout_list_add_timeout (connection->timeouts,
+ timeout);
+ else
+ return FALSE;
+}
+
+void
+_dbus_connection_remove_timeout (DBusConnection *connection,
+ DBusTimeout *timeout)
+{
+ if (connection->timeouts) /* null during finalize */
+ _dbus_timeout_list_remove_timeout (connection->timeouts,
+ timeout);
+}
+
/**
* Tells the connection that the transport has been disconnected.
* Results in calling the application disconnect callback.
@@ -498,7 +518,7 @@ dbus_connection_unref (DBusConnection *connection)
{
_dbus_assert (connection != NULL);
_dbus_assert (connection->refcount > 0);
-
+
connection->refcount -= 1;
if (connection->refcount == 0)
{
@@ -518,13 +538,13 @@ dbus_connection_unref (DBusConnection *connection)
_dbus_counter_unref (connection->connection_counter);
connection->connection_counter = NULL;
}
-
+
_dbus_watch_list_free (connection->watches);
connection->watches = NULL;
-
+
_dbus_timeout_list_free (connection->timeouts);
connection->timeouts = NULL;
-
+
_dbus_connection_free_data_slots (connection);
_dbus_hash_iter_init (connection->handler_table, &iter);
@@ -1036,8 +1056,14 @@ dbus_connection_set_watch_functions (DBusConnection *connection,
* The DBusTimeout can be queried for the timer interval using
* dbus_timeout_get_interval.
*
- * Once a timeout occurs, dbus_timeout_handle should be call to invoke
+ * Once a timeout occurs, dbus_timeout_handle should be called to invoke
* the timeout's callback.
+ *
+ * @param connection the connection.
+ * @param add_function function to add a timeout.
+ * @param remove_function function to remove a timeout.
+ * @param data data to pass to add_function and remove_function.
+ * @param free_data_function function to be called to free the data.
*/
void
dbus_connection_set_timeout_functions (DBusConnection *connection,