From 5efe8e7f1d97931710558495a951e0b35afbfb72 Mon Sep 17 00:00:00 2001 From: "John (J5) Palmieri" Date: Fri, 14 Jul 2006 03:09:22 +0000 Subject: * dbus-connection.c (dbus_connection_send_with_reply): return TRUE and set pending_reply out arg to NULL is connection is disconnected (connection_timeout_and_complete_all_pending_calls_unlocked): New static method for cleaning up pending calls on disconnect (_dbus_connection_get_dispatch_status_unlocked): If we have pending calls queued timeouts on disconnect * dbus/dbus-pending-call.ci (_dbus_pending_call_set_connection): Remove --- dbus/dbus-pending-call.c | 38 +++++++------------------------------- 1 file changed, 7 insertions(+), 31 deletions(-) (limited to 'dbus/dbus-pending-call.c') diff --git a/dbus/dbus-pending-call.c b/dbus/dbus-pending-call.c index 66573f66..e3bfbb42 100644 --- a/dbus/dbus-pending-call.c +++ b/dbus/dbus-pending-call.c @@ -83,7 +83,7 @@ _dbus_pending_call_new (DBusConnection *connection, DBusTimeout *timeout; _dbus_assert (timeout_milliseconds >= 0 || timeout_milliseconds == -1); - + if (timeout_milliseconds == -1) timeout_milliseconds = _DBUS_DEFAULT_TIMEOUT_VALUE; @@ -119,8 +119,11 @@ _dbus_pending_call_new (DBusConnection *connection, pending->refcount.value = 1; pending->connection = connection; + dbus_connection_ref (pending->connection); + pending->timeout = timeout; + _dbus_data_slot_list_init (&pending->slot_list); return pending; @@ -284,34 +287,6 @@ _dbus_pending_call_get_connection (DBusPendingCall *pending) return pending->connection; } -/** - * Sets the connection associated with the pending call - * - * @param pending the pending_call - * @param connection the connection which is associated with the pending call - */ -void -_dbus_pending_call_set_connection (DBusPendingCall *pending, - DBusConnection *connection) -{ - _dbus_assert (pending != NULL); - - pending->connection = connection; -} - -/** - * NULLs out the connection - * - * @param pending the pending_call - */ -void -_dbus_pending_call_clear_connection (DBusPendingCall *pending) -{ - _dbus_assert (pending != NULL); - - pending->connection = NULL; -} - /** * Sets the reply message associated with the pending call to a timeout error * @@ -403,12 +378,13 @@ dbus_pending_call_unref (DBusPendingCall *pending) /* If we get here, we should be already detached * from the connection, or never attached. */ - _dbus_assert (pending->connection == NULL); _dbus_assert (!pending->timeout_added); + + dbus_connection_unref (pending->connection); /* this assumes we aren't holding connection lock... */ _dbus_data_slot_list_free (&pending->slot_list); - + if (pending->timeout != NULL) _dbus_timeout_unref (pending->timeout); -- cgit