[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-avahi
Subject:    Re: [avahi] Published service still browseable in other machines
From:       Robin Perkins <robin.perkins () internode ! on ! net>
Date:       2009-11-05 10:52:13
Message-ID: 555796B6-421D-442E-9AB8-4D9760B55763 () internode ! on ! net
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On 05/11/2009, at 6:16 PM, José Félix Ontañón wrote:

>
>
> 2009/11/5 Trent Lloyd <lathiat@bur.st>
> Hi Jose,
>
> On 05/11/2009, at 6:35 AM, José Félix Ontañón wrote:
>
> > Hi everyone!
> >
> > I'm a newbie playing with python-avahi trying to code some kind of
> > master-slave application for shutdown every machine at same time.
> > When the master it's ordered to shutdown, it sends the signal to the
> > slaves. The slaves publish/unpublish the service via avahi, and the
> > master
> > discover them via ItemNew/ItemRemove signals. Very strait-forward,
> > isn't?
> >
> > The avahi publish/unpublish/discover services it's gorgeous but i've
> > found that if a slave, that has published the service via avahi,
> > losts it
> > network (i.e. the wifi ap goes out of power), the master still
> > discovering it! and no ItemRemove signal it's raised at all. Is it
> > normal? Am i doing something wrong?
> >
> > To solve it, i've implemented some kind of "ping" to the slaves
> > service every Xseconds. When a new slave it's discovered, the
> > periodic ping starts.
> > When ping it's failing i know there be some problem with networking.
> >
> > I wonder if avahi itself provides a native workaround to avoid the
> > coding of those nasty "ping" cycles ...
>
> This is normal.. it will disappear after some time.
>
> The instant removal of an advertised service relies on the host
> sending a "gone away" message (more specifically, it updates the TTL
> of its record to expire in I think.. 1 second)
>
> This is because mDNS uses caching.. if it didn't use caching it would
> cause alot more network traffic and would hammer especially wireless
> networks.
>
>
>
> Having not really worked with it for a while.. I can't remember all
> the details but I suspect you can change the TTL in the Avahi API call
> to make these timeouts happen a little quicker, but you will increase
> network traffic by doing so.
>
> Really your application should not rely on Avahi for "service
> undiscovery".. it's meant generally for "unreliable service
> discovery".  You are best of actually having some protocol between the
> master and slave and just using avahi for the slave to find the master
> in the first instance.
>
> Regards,
> Trent
> _______________________________________________
> avahi mailing list
> avahi@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/avahi
>
>
> Ok, in this case i'll continue with my ping aproximation. It works  
> fairly well.
>
> Thanks Trent.
>

 From what I remember reading the docs, what is supposed to happen is  
when someone goes to try and use a service that is no longer there, it  
should fail and immediately flush that entry from the cache so that  
its no longer an option in the user interface.

Rob
[Attachment #5 (unknown)]

<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; \
-webkit-line-break: after-white-space; "><div><br></div><div><div>On 05/11/2009, at \
6:16 PM, José Félix Ontañón wrote:</div><br \
class="Apple-interchange-newline"><blockquote type="cite"><br><br><div \
class="gmail_quote">2009/11/5 Trent Lloyd <span dir="ltr">&lt;<a \
href="mailto:lathiat@bur.st">lathiat@bur.st</a>&gt;</span><br><blockquote \
class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt \
0pt 0.8ex; padding-left: 1ex;"> Hi Jose,<br>
<div><div></div><div class="h5"><br>
On 05/11/2009, at 6:35 AM, José Félix Ontañón wrote:<br>
<br>
&gt; Hi everyone!<br>
&gt;<br>
&gt; I'm a newbie playing with python-avahi trying to code some kind of<br>
&gt; master-slave application for shutdown every machine at same time.<br>
&gt; When the master it's ordered to shutdown, it sends the signal to the<br>
&gt; slaves. The slaves publish/unpublish the service via avahi, and the<br>
&gt; master<br>
&gt; discover them via ItemNew/ItemRemove signals. Very strait-forward,<br>
&gt; isn't?<br>
&gt;<br>
&gt; The avahi publish/unpublish/discover services it's gorgeous but i've<br>
&gt; found that if a slave, that has published the service via avahi,<br>
&gt; losts it<br>
&gt; network (i.e. the wifi ap goes out of power), the master still<br>
&gt; discovering it! and no ItemRemove signal it's raised at all. Is it<br>
&gt; normal? Am i doing something wrong?<br>
&gt;<br>
&gt; To solve it, i've implemented some kind of "ping" to the slaves<br>
&gt; service every Xseconds. When a new slave it's discovered, the<br>
&gt; periodic ping starts.<br>
&gt; When ping it's failing i know there be some problem with networking.<br>
&gt;<br>
&gt; I wonder if avahi itself provides a native workaround to avoid the<br>
&gt; coding of those nasty "ping" cycles ...<br>
<br>
</div></div>This is normal.. it will disappear after some time.<br>
<br>
The instant removal of an advertised service relies on the host<br>
sending a "gone away" message (more specifically, it updates the TTL<br>
of its record to expire in I think.. 1 second)<br>
<br>
This is because mDNS uses caching.. if it didn't use caching it would<br>
cause alot more network traffic and would hammer especially wireless<br>
networks.<br>
<br>
<br>
<br>
Having not really worked with it for a while.. I can't remember all<br>
the details but I suspect you can change the TTL in the Avahi API call<br>
to make these timeouts happen a little quicker, but you will increase<br>
network traffic by doing so.<br>
<br>
Really your application should not rely on Avahi for "service<br>
undiscovery".. it's meant generally for "unreliable service<br>
discovery". &nbsp;You are best of actually having some protocol between the<br>
master and slave and just using avahi for the slave to find the master<br>
in the first instance.<br>
<br>
Regards,<br>
Trent<br>
_______________________________________________<br>
avahi mailing list<br>
<a href="mailto:avahi@lists.freedesktop.org">avahi@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/avahi" \
target="_blank">http://lists.freedesktop.org/mailman/listinfo/avahi</a><br> \
</blockquote></div><br><br>Ok, in this case i'll continue with my ping aproximation. \
It works fairly well.<br><br>Thanks Trent.<br \
clear="all"><br></blockquote></div><div>From what I remember reading the docs, what \
is supposed to happen is when someone goes to try and use a service that is no longer \
there, it should fail and immediately&nbsp;flush that entry from the cache so that \
its no longer an option in the user \
interface.</div><div><br></div><div>Rob</div></body></html>



_______________________________________________
avahi mailing list
avahi@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/avahi


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic