[telepathy-mission-control/master] McdDispatchOperation: split up APPROVAL_TYPE_FINISHED according to the real reason, and set it earlier

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Oct 27 13:53:35 PDT 2009


This is a behaviour change:
1. an approval is appended to the list as soon as HandleWith or Claim
   is called, or a channel is re-requested
2. no approval is appended to the list if the CDO finishes because all
   channels have been lost
3. no approval is appended to the list when HandleChannels has been called
   successfully
4. no approval is appended to the list if the channels are undispatchable

However, none of these is harmful:
1. the approval does not cause immediate invocation of the handlers if
   may_signal_finish() would return false, because both the counters
   influencing may_signal_finish are also client locks
2. approval is meaningless if all channels have been lost
3. HandleChannels can only be called after client locks have been
   released, so adding approval at this stage is not meaningful
4. the channels cannot be found to be undispatchable until after client
   locks have been released, so adding approval at this stage is not
   meaningful
---
 src/mcd-dispatch-operation.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/mcd-dispatch-operation.c b/src/mcd-dispatch-operation.c
index ba2b08d..2339aed 100644
--- a/src/mcd-dispatch-operation.c
+++ b/src/mcd-dispatch-operation.c
@@ -77,7 +77,9 @@ G_DEFINE_TYPE_WITH_CODE (McdDispatchOperation, _mcd_dispatch_operation,
 
 typedef enum {
     APPROVAL_TYPE_REQUESTED,
-    APPROVAL_TYPE_FINISHED,
+    APPROVAL_TYPE_HANDLE_WITH,
+    APPROVAL_TYPE_CLAIM,
+    APPROVAL_TYPE_CHANNELS_LOST,
     APPROVAL_TYPE_NO_APPROVERS
 } ApprovalType;
 
@@ -534,8 +536,6 @@ mcd_dispatch_operation_actually_finish (McdDispatchOperation *self)
     if (self->priv->awaiting_approval)
     {
         self->priv->awaiting_approval = FALSE;
-        g_queue_push_tail (self->priv->approvals,
-                           approval_new (APPROVAL_TYPE_FINISHED));
         _mcd_dispatch_operation_check_client_locks (self);
     }
 
@@ -604,6 +604,8 @@ dispatch_operation_handle_with (TpSvcChannelDispatchOperation *cdo,
                                         MCD_CLIENT_BASE_NAME_LEN);
     }
 
+    g_queue_push_tail (self->priv->approvals,
+                       approval_new (APPROVAL_TYPE_HANDLE_WITH));
     _mcd_dispatch_operation_finish (self);
     tp_svc_channel_dispatch_operation_return_from_handle_with (context);
 }
@@ -632,6 +634,8 @@ dispatch_operation_claim (TpSvcChannelDispatchOperation *self,
     priv->claim_context = context;
     DEBUG ("Claiming on behalf of %s", priv->claimer);
 
+    g_queue_push_tail (priv->approvals,
+                       approval_new (APPROVAL_TYPE_CLAIM));
     _mcd_dispatch_operation_finish (MCD_DISPATCH_OPERATION (self));
 }
 
@@ -1254,6 +1258,8 @@ _mcd_dispatch_operation_approve (McdDispatchOperation *self,
             return;
         }
 
+        g_queue_push_tail (self->priv->approvals,
+                           approval_new (APPROVAL_TYPE_REQUESTED));
         _mcd_dispatch_operation_finish (self);
     }
     else
-- 
1.5.6.5




More information about the telepathy-commits mailing list