<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Sep 27, 2013 at 12:28 PM, Simon <span style class="">McVittie</span> <span dir="ltr"><<a href="mailto:simon.mcvittie@collabora.co.uk" target="_blank"><span style class="">simon</span>.<span style class="">mcvittie</span>@<span style class="">collabora</span>.co.<span style class="">uk</span></a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 27/09/13 15:40, Tiago Katcipis wrote:<br>
> Thanks for your reply (incredibly complete :-)<br>
<br>
</div>We've given this sort of thing a lot of thought over the last few years :-)<br>
<div class="im"><br>
> This already gives an idea of a way to check if a proxy to an object is<br>
> valid. Checking telepathy glib i could see that it TpProxy already has<br>
> this concept:<br>
><br>
> <a href="http://telepathy.freedesktop.org/doc/telepathy-glib/telepathy-glib-proxy.html#tp-proxy-get-invalidated" target="_blank">http://telepathy.freedesktop.org/doc/telepathy-glib/telepathy-glib-proxy.html#tp-proxy-get-invalidated</a><br>
<br>
</div>That's actually a slightly stronger concept: it's used to track objects<br>
that have vanished from D-Bus altogether. A (client proxy for a) Call1<br>
channel doesn't emit invalidated when it terminates; it only emits<br>
invaliated on Closed (or a CM crash or whatever).<br>
<br>
TpProxy also has tp_proxy_prepare_async() which encapsulates the concept<br>
of "this thing is ready, and we've verified that it actually exists"<br>
(and also checking for and configuring optional features/interfaces).<br>
<div class="im"><br>
> It seems to be a good idea to implement a generic wrapper around DBus<br>
> proxies to implement this kind of checking (avoiding the replication of<br>
> the checking on all clients).<br>
<br>
</div>Checking whether a D-Bus object is valid is domain-specific: there is no<br>
API that every D-Bus object is guaranteed to implement. In any case, to<br>
minimize bus traffic, you usually want to do the validity check as a<br>
side-effect of something domain-specific and useful that you wanted to<br>
do anyway (e.g. GetAll), rather than a separate method call.<br>
<br>
For GDBusProxy subclasses, implementing g_async_initable_async() is a<br>
good way to encapsulate the initial "is it intact?" check and state<br>
download. If we were writing telepathy-glib now, the "core" feature on<br>
each proxy would probably be represented by g_async_initable_async().<br></blockquote><div><br></div><div>By this you mean inherit from the <span style class="">GDBusProxy</span> and extend the initialization process right? because from my experience <span style class="">GDBus</span> does no validation on the proxies you create, you can create a proxy to any crap and it will be well succeeded :-) (it will deliver to you an awesome <span style class="">GDBusProxy</span> pointer).<br>
<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
> I can see [round-trip avoidance] on the Connection.Requests interface:<br>
<div class="im">><br>
> <a href="http://telepathy.freedesktop.org/spec/Connection_Interface_Requests.html#Struct:Channel_Details" target="_blank">http://telepathy.freedesktop.org/spec/Connection_Interface_Requests.html#Struct:Channel_Details</a><br>
><br>
> It can even prevent some observers from creating proxies if they only<br>
> need the immutable information, nice.<br>
<br>
</div>Like I said, we've put a lot of thought into this sort of thing. We're<br>
currently deleting all the "first attempt" APIs from the Telepathy 1.0<br>
branch, so it will only have the revised, good ones :-)<br>
<div class="im"><br>
> * change notification: if there's a GetThings method or a readable<br>
> property, then there should be a way to keep up with its current<br>
> value by watching signals, to avoid having to poll<br>
><br>
> Here we are doing something a little different, since properties on<br>
> GDBus can be monitored we where just using readable properties and if<br>
> they change GDBus will deliver the change on the "notify:property-name"<br>
> signal (PropertiesChanged signal under the hood to do this).<br>
<br>
</div>PropertiesChanged *is* a change-notification implementation - it's just<br>
a way to share the change notification infrastructure between 99% of<br>
interfaces (so GDBus has more code, and you have less).<br>
<br>
Similarly, Properties.GetAll() and the ObjectManager interface provide a<br>
"95%" implementation of state recovery and change notification, so that<br>
in common cases (object trees with a small-to-medium branching factor)<br>
you don't have to invent quite so many wheels.<br>
<br>
Some parts of Telepathy use PropertiesChanged, some parts only don't use<br>
it because they were written first, and some (the Group interface, as<br>
used on IRC) are in the 1% where PropertiesChanged is likely to be a<br>
performance problem.<br></blockquote><div><br></div><div>I see, good to know that there is no problem on using properties changed (performance can be a problem, so I'm going to keep my eyes open :-).<br><br></div><div>
When you said that the Call1 already has support for termination but still existing on <span style class="">DBus</span> you mean that:<br><br>1 - Call1 will emit a <span style class="">CallStateChanged</span> to Ended.<br>
2 - Someone call the Channel interface Close method (the handler?).<br></div><div>3 - Then the Closed signal is emitted and the object is no longer valid.<br><br></div><div>This idea really seems to be a start to solve our problems, not all, but some.<br>
<br></div><div>Regards,<br></div><div>Tiago Katcipis<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
S<br>
<br>
_______________________________________________<br>
telepathy mailing list<br>
<a href="mailto:telepathy@lists.freedesktop.org">telepathy@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/telepathy" target="_blank">http://lists.freedesktop.org/mailman/listinfo/telepathy</a><br>
</div></div></blockquote></div><br></div></div>