[avahi] when can avahi_entry_group_commit return "Bad state" ?

Lennart Poettering lennart at poettering.net
Fri Sep 5 01:50:59 PDT 2008


On Tue, 02.09.08 19:00, Julien PUYDT (julien.puydt at laposte.net) wrote:

> >> I have a bug where I get published correctly at first, but don't manage 
> >> to update my information later : avahi_entry_group_commit returns "Bad 
> >> state"...
> >>
> >> What should I do after/before 
> >> avahi_entry_group_update_service_txt_strlst so that my data is updated?
> > 
> > the Avahi client will return AVAHI_ERR_BAD_STATE if you commit an
> > entry group whose connection to the server is dead.
> 
> Hmmm... and how do I know if the connection to the server is dead? 
> Shouldn't I know from the callback client?

You can find that out with avahi_client_get_state(). If the state is
any of AVAHI_CLIENT_S_REGISTERING, AVAHI_CLIENT_S_COLLISION and
AVAHI_CLIENT_S_RUNNING a connection tot he Avahi daemon is available.

If the state is AVAHI_CLIENT_S_RUNNING the host name is well
established and you may install entry groups which refer to the host
name. If the state leaves AVAHI_CLIENT_S_RUNNING you should remove
your entry groups since the hostname they internally might refer to is
no longer established.

Browsers/resolvers may be kept during the whole time we are in one of
the aforementioned AVAHI_CLIENT_S_xxx states.

This is documented on http://avahi.org/download/doxygen/main.html
under "How to Register Services".

Lennart

-- 
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net         ICQ# 11060553
http://0pointer.net/lennart/           GnuPG 0x1A015CC4


More information about the avahi mailing list