From e35291afaace4f378dd34377cd976003735af47c Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 19 Apr 2010 15:11:59 +0200 Subject: dispatcher_connection_invalidated_cb: terminate pending requests --- libempathy/empathy-dispatcher.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'libempathy/empathy-dispatcher.c') diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c index d0dbc6380..8d91928f6 100644 --- a/libempathy/empathy-dispatcher.c +++ b/libempathy/empathy-dispatcher.c @@ -335,8 +335,31 @@ dispatcher_connection_invalidated_cb (TpConnection *connection, EmpathyDispatcher *self) { EmpathyDispatcherPriv *priv = GET_PRIV (self); + ConnectionData *connection_data; DEBUG ("Error: %s", message); + + /* Terminate pending requests, if any */ + connection_data = g_hash_table_lookup (priv->connections, connection); + if (connection_data != NULL) + { + GList *l; + GError *error; + + error = g_error_new_literal (domain, code, message); + + for (l = connection_data->outstanding_requests; l != NULL; + l = g_list_next (l)) + { + DispatcherRequestData *request_data = l->data; + + if (request_data->cb != NULL) + request_data->cb (NULL, error, request_data->user_data); + } + + g_error_free (error); + } + g_hash_table_remove (priv->connections, connection); } -- cgit v1.2.3