Bug 70134 - Gabble: implement ClientTypes.RequestClientTypes()
Summary: Gabble: implement ClientTypes.RequestClientTypes()
Status: RESOLVED FIXED
Alias: None
Product: Telepathy
Classification: Unclassified
Component: gabble (show other bugs)
Version: unspecified
Hardware: Other All
: medium enhancement
Assignee: Telepathy bugs list
QA Contact: Telepathy bugs list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-04 14:21 UTC by Guillaume Desmottes
Modified: 2013-10-04 15:56 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
client-types: implement RequestClientTypes() (6.91 KB, patch)
2013-10-04 14:24 UTC, Guillaume Desmottes
Details | Splinter Review
new patch (3.80 KB, patch)
2013-10-04 15:50 UTC, Guillaume Desmottes
Details | Splinter Review

Description Guillaume Desmottes 2013-10-04 14:21:01 UTC
http://telepathy.freedesktop.org/spec/Connection_Interface_Client_Types.html#Method:RequestClientTypes is not implemented in master
Comment 1 Guillaume Desmottes 2013-10-04 14:24:30 UTC
Created attachment 87122 [details] [review]
client-types: implement RequestClientTypes()
Comment 2 Simon McVittie 2013-10-04 14:30:51 UTC
Comment on attachment 87122 [details] [review]
client-types: implement RequestClientTypes()

Review of attachment 87122 [details] [review]:
-----------------------------------------------------------------

::: src/conn-client-types.c
@@ +153,5 @@
> +      g_error_free (error);
> +      return;
> +    }
> +
> +  DEBUG ("GetClientTypes called on the following handle: %u", contact);

That isn't its name.

@@ +157,5 @@
> +  DEBUG ("GetClientTypes called on the following handle: %u", contact);
> +
> +  if (!get_client_types_from_handle (conn, contact, &types))
> +    {
> +      DEBUG ("  waiting for disco reply");

Do we not have API for "disco them and wait for a response" already?

If we can't see the presence of any of their resources, shouldn't we give up immediately, rather than timing out?

@@ +160,5 @@
> +    {
> +      DEBUG ("  waiting for disco reply");
> +
> +      g_hash_table_insert (conn->client_types_pending,
> +              GUINT_TO_POINTER (contact), context);

If two RequestClientTypes calls overlap, the first one will never get a reply and the resources will never be freed.

Similarly, if we never get a disco result for that contact, we'll never send a reply and the resources will never be freed.
Comment 3 Simon McVittie 2013-10-04 14:32:25 UTC
If waiting for disco isn't feasible, I think implementing this as a copy of GetClientTypes(), and opening a bug saying "implementation of RequestClientTypes should wait", would be better than nothing.
Comment 4 Guillaume Desmottes 2013-10-04 15:11:00 UTC
(In reply to comment #2)
> Comment on attachment 87122 [details] [review] [review]
> client-types: implement RequestClientTypes()
> 
> Review of attachment 87122 [details] [review] [review]:
> -----------------------------------------------------------------
> 
> ::: src/conn-client-types.c
> @@ +153,5 @@
> > +      g_error_free (error);
> > +      return;
> > +    }
> > +
> > +  DEBUG ("GetClientTypes called on the following handle: %u", contact);
> 
> That isn't its name.

fixed.

> @@ +157,5 @@
> > +  DEBUG ("GetClientTypes called on the following handle: %u", contact);
> > +
> > +  if (!get_client_types_from_handle (conn, contact, &types))
> > +    {
> > +      DEBUG ("  waiting for disco reply");
> 
> Do we not have API for "disco them and wait for a response" already?

Yeah, I could use gabble_disco_request_with_timeout() but that will fire a new disco query. I don't think we have API to ask to be notified when the existing disco is completed.

> If we can't see the presence of any of their resources, shouldn't we give up
> immediately, rather than timing out?

get_client_types_from_handle() returns an empty array in this case.

> @@ +160,5 @@
> > +    {
> > +      DEBUG ("  waiting for disco reply");
> > +
> > +      g_hash_table_insert (conn->client_types_pending,
> > +              GUINT_TO_POINTER (contact), context);
> 
> If two RequestClientTypes calls overlap, the first one will never get a
> reply and the resources will never be freed.
> 
> Similarly, if we never get a disco result for that contact, we'll never send
> a reply and the resources will never be freed.

Good point.
Comment 5 Guillaume Desmottes 2013-10-04 15:50:31 UTC
(In reply to comment #3)
> If waiting for disco isn't feasible, I think implementing this as a copy of
> GetClientTypes(), and opening a bug saying "implementation of
> RequestClientTypes should wait", would be better than nothing.

Ok, I've done that for now as that's not a regression anyway.
Comment 6 Guillaume Desmottes 2013-10-04 15:50:48 UTC
Created attachment 87130 [details] [review]
new patch
Comment 7 Simon McVittie 2013-10-04 15:53:58 UTC
It'll do for now. Thanks!
Comment 8 Guillaume Desmottes 2013-10-04 15:56:08 UTC
Merged to master.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.