From dcf0aa99ff9f0bded5ddfe1555a4245a9cd769ba Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 19 May 2011 13:38:20 +0100 Subject: [PATCH 1/3] fd.o #34025: call ObserveChannels for channels waiting in CDOs when recovering Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34025 --- src/mcd-dispatch-operation-priv.h | 2 ++ src/mcd-dispatch-operation.c | 8 ++++++++ src/mcd-dispatcher.c | 31 +++++++++++++++++++++++++++++-- 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/src/mcd-dispatch-operation-priv.h b/src/mcd-dispatch-operation-priv.h index c92289c..ae0d799 100644 --- a/src/mcd-dispatch-operation-priv.h +++ b/src/mcd-dispatch-operation-priv.h @@ -118,6 +118,8 @@ G_GNUC_INTERNAL void _mcd_dispatch_operation_forget_channels ( G_GNUC_INTERNAL gboolean _mcd_dispatch_operation_is_internal ( McdDispatchOperation *self); +G_GNUC_INTERNAL gboolean _mcd_dispatch_operation_has_invoked_observers ( + McdDispatchOperation *self); G_END_DECLS diff --git a/src/mcd-dispatch-operation.c b/src/mcd-dispatch-operation.c index 8f79d5b..cb1e83a 100644 --- a/src/mcd-dispatch-operation.c +++ b/src/mcd-dispatch-operation.c @@ -2604,3 +2604,11 @@ _mcd_dispatch_operation_destroy_channels (McdDispatchOperation *self) _mcd_dispatch_operation_forget_channels (self); } + +/* This should really be called ..._has_invoked_observers_if_needed, + * but that name would be ridiculous. */ +gboolean +_mcd_dispatch_operation_has_invoked_observers (McdDispatchOperation *self) +{ + return self->priv->invoked_observers_if_needed; +} diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c index fcb2d0b..0b7de91 100644 --- a/src/mcd-dispatcher.c +++ b/src/mcd-dispatcher.c @@ -664,10 +664,10 @@ static void mcd_dispatcher_client_needs_recovery_cb (McdClientProxy *client, McdDispatcher *self) { - GList *channels = + const GList *channels = _mcd_handler_map_get_handled_channels (self->priv->handler_map); const GList *observer_filters; - GList *list; + const GList *list; DEBUG ("called"); @@ -706,6 +706,33 @@ mcd_dispatcher_client_needs_recovery_cb (McdClientProxy *client, } } + + /* we also need to think about channels that are still being dispatched, + * but have got far enough that this client wouldn't otherwise see them */ + for (list = self->priv->operations; list != NULL; list = list->next) + { + McdDispatchOperation *op = list->data; + + if (_mcd_dispatch_operation_has_invoked_observers (op)) + { + for (channels = _mcd_dispatch_operation_peek_channels (op); + channels != NULL; + channels = channels->next) + { + McdChannel *mcd_channel = channels->data; + GHashTable *properties = + _mcd_channel_get_immutable_properties (mcd_channel); + + if (_mcd_client_match_filters (properties, observer_filters, + FALSE)) + { + _mcd_client_recover_observer (client, + mcd_channel_get_tp_channel (mcd_channel), + _mcd_dispatch_operation_get_account_path (op)); + } + } + } + } } static void -- 1.7.5.1