[avahi] Mono apps don't get notified of ClientState.Running
Celso Pinto
cpinto at yimports.com
Sun Apr 30 19:58:16 PDT 2006
Hi everyone,
I'm programming an application that uses Avahi's Mono bindings and I
think I found an ugly problem: when a Mono app creates an instance of
Avahi.Client, the constructor of this class invokes the native
avahi_client_new method, which receives a parameter for the client_state
callback.
While still in construction, the Avahi.Client class gets notified that
the ClientState is now Running, so the Client.OnClientCallback method is
invoked but the StateChanged event still doesn't contain any Handlers
because this is all happening during construction of the Avahi.Client
object.
This means that applications, like my own, that are waiting on the
StateChanged event with a ClientState.Running value to start publishing
their services never get notified, therefore never get to publish anything.
The only way to fix this problem is to create a Client.Connect() method.
This allows us to first create an instance of Avahi.Client, then add a
delegate to the StateChanged event and finally call the
Avahi.Client.Connect() method. Only then our callbacks get notified of
the running state.
The big question is: because this will break the current behaviour of
the Avahi.Client class (meaning that the client connects to the daemon
during construction), will you guys make the necessary changes?
Cheers,
Celso
More information about the avahi
mailing list