[Bug 13422] Add nice API for channel creation

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Jul 13 16:16:33 CEST 2010


https://bugs.freedesktop.org/show_bug.cgi?id=13422

--- Comment #11 from Simon McVittie <simon.mcvittie at collabora.co.uk> 2010-07-13 07:16:33 PDT ---
In the successful case, the temporary handler should stick around until the
channel is invalidated, for MC crash-recovery (it needs to be able to say it's
handling the channel, otherwise MC will close the channel while recovering from
a crash). I think it'd make sense to replace request_ctx with a private
subclass of TpBaseClient - perhaps called TpAccountCreateAndHandleHelper? -
which survives until either the channel request fails, or the channel is
invalidated.

The request_ctx shouldn't need to have the TpDBusDaemon in it; I've added
tp_base_client_get_dbus_daemon() in my trivia branch.

> +      GError error = { TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
> +          "We are supposed to handle only one channel" };
> +
> +      tp_handle_channels_context_fail (context, &error);
> +      /* FIXME: Should we fail the operation ? */

Yes, we should, otherwise the operation will never finish.

Shouldn't this async operation be cancellable? The meaning of cancelling the
GCancellable would be something like this:

* if CreateChannel hasn't returned yet, do nothing
* when CreateChannel returns: if already cancelled, call Cancel on the
ChannelRequest
* if CreateChannel has already returned, but the ChannelRequest hasn't been
invalidated, call Cancel on it
* if the ChannelRequest has already been invalidated, we're too late to cancel,
so ignore it

This would mean that cancelling the GCancellable would raise TP_ERROR_CANCELLED
instead of G_IO_ERROR_CANCELLED, which I think is OK. It'd also raise
TP_ERROR_CANCELLED if someone other than us cancelled the request for some
reason, or if the TpConnection was disconnected by our request.

> +  if (tp_cli_channel_request_connect_to_failed (ctx->chan_request,
> +      channel_request_failed_cb, ctx, NULL,
> +      G_OBJECT (ctx->result), &err) == NULL)

Connect to TpProxy::invalidated, so you'll handle an MC crash correctly.
Succeeded maps to TP_DBUS_ERROR_OBJECT_REMOVED, so you'll need to ignore that
case with g_error_matches(), if you wanted to ignore Succeeded.

> +  if (g_list_length (channels) != 1)

G_UNLIKELY?

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.



More information about the telepathy-bugs mailing list