- /* Request could either be by us or by a remote party. If there are no
- * outstanding requests for this channel type we can assume it's remote.
- * Otherwise we wait untill they are all satisfied */
- if (dispatcher_operation_can_start (self, operation, cd))
- dispatcher_start_dispatching (self, operation, cd);
- else
- g_hash_table_insert (cd->outstanding_channels,
- g_strdup (object_path), operation);
- }
- else
- {
- dispatcher_start_dispatching (self, operation, cd);
+ GList *l;
+ gboolean found = FALSE;
+
+ l = cd->outstanding_requests;
+
+ while (l != NULL)
+ {
+ DispatcherRequestData *d = (DispatcherRequestData *) l->data;
+ guint n;
+ const gchar *path;
+
+ l = g_list_next (l);
+ if (d->request == NULL)
+ continue;
+
+ if (d->operation != NULL)
+ continue;
+
+ path = tp_proxy_get_object_path (d->channel_request);
+ for (n = 0; n < requests_satisfied->len ; n++)
+ {
+ const gchar *p = g_ptr_array_index (requests_satisfied, n);
+ if (!tp_strdiff (p, path))
+ {
+ DEBUG ("Channel satified request %s"
+ "(already dispatched: %d)", p, found);
+ if (!found)
+ {
+ d->operation = operation;
+ found = TRUE;
+ continue;
+ }
+ else
+ {
+ GError err = { TP_ERRORS, TP_ERROR_NOT_YOURS,
+ "Not yours!" };
+ dispatcher_request_failed (dispatcher, d, &err);
+ }
+ }
+ }
+ }