Setting a timeout value for .service file

View: New views
3 Messages — Rating Filter:   Alert me  

Setting a timeout value for .service file

by petrivir :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

I'm working on software for mesh networking that uses Avahi for service discovery.

I'm publishing the mesh stations in /etc/avahi/services/ with my own service type. The .service file is created when a user joins the network and deleted when user leaves from it.

The problem is that if user is disconnected from the network by - let's say unplugging the usb wlan adapter - the station still appears in the Avahi Discovery (and in the software) for too long. Is there a way to control the timeout when using .service files?

Thanks for your time,
Petri
_______________________________________________
avahi mailing list
avahi@...
http://lists.freedesktop.org/mailman/listinfo/avahi

Re: Setting a timeout value for .service file

by Bugzilla from robin.perkins@internode.on.net :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 13/08/2009, at 11:03 PM, Petri Virkkala wrote:

> Hi all,
>
> I'm working on software for mesh networking that uses Avahi for  
> service discovery.
>
> I'm publishing the mesh stations in /etc/avahi/services/ with my own  
> service type. The .service file is created when a user joins the  
> network and deleted when user leaves from it.
>
> The problem is that if user is disconnected from the network by -  
> let's say unplugging the usb wlan adapter - the station still  
> appears in the Avahi Discovery (and in the software) for too long.  
> Is there a way to control the timeout when using .service files?
>
> Thanks for your time,
> Petri
> _______________________________________________
> avahi mailing list
> avahi@...
> http://lists.freedesktop.org/mailman/listinfo/avahi


The /etc/avahi/services file is only really a hack to allow daemons  
and programs that don't support Avahi to be able to at least somehow  
advertise that they are there.

If you are writing your own service, then you will be much better off  
interacting with Avahi through the shared library from within your  
daemon/app - that way additions, edits and removals of your service  
are thrown to the network immediately.

Rob


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

Re: Setting a timeout value for .service file

by Lennart Poettering-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 13.08.09 16:03, Petri Virkkala (petri.virkkala@...) wrote:

> Hi all,
>
> I'm working on software for mesh networking that uses Avahi for
> service discovery.
>
> I'm publishing the mesh stations in /etc/avahi/services/ with my own
> service type. The .service file is created when a user joins the
> network and deleted when user leaves from it.
>
> The problem is that if user is disconnected from the network by -
> let's say unplugging the usb wlan adapter - the station still
> appears in the Avahi Discovery (and in the software) for too
> long. Is there a way to control the timeout when using .service
> files?

Uh, dynamically dropping .service files into /etc/avahi/services/ is
really hackish, as Robin already pointed out.

The TTL can only be set in the lowest-level DNS RR registration C
API. If you need to fiddle with the TTL than you need to use
avahi_entry_group_add_record().

However, I am not sure that playing games with the TTL like this is
really a good idea anyway.

Lennart

--
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/           GnuPG 0x1A015CC4
_______________________________________________
avahi mailing list
avahi@...
http://lists.freedesktop.org/mailman/listinfo/avahi