switch (client->state) {
case AVAHI_CLIENT_DISCONNECTED:
+ case AVAHI_CLIENT_FAILURE:
if (client->bus) {
dbus_connection_disconnect(client->bus);
dbus_connection_unref(client->bus);
/** States of a client object, a superset of AvahiServerState */
typedef enum {
- AVAHI_CLIENT_S_REGISTERING = AVAHI_SERVER_REGISTERING,
- AVAHI_CLIENT_S_RUNNING = AVAHI_SERVER_RUNNING,
- AVAHI_CLIENT_S_COLLISION = AVAHI_SERVER_COLLISION,
- AVAHI_CLIENT_DISCONNECTED = 100 /**< Lost DBUS connection to the Avahi daemon */
+ AVAHI_CLIENT_S_REGISTERING = AVAHI_SERVER_REGISTERING, /**< Server state: REGISTERING */
+ AVAHI_CLIENT_S_RUNNING = AVAHI_SERVER_RUNNING, /**< Server state: RUNNING */
+ AVAHI_CLIENT_S_COLLISION = AVAHI_SERVER_COLLISION, /**< Server state: COLLISION */
+ AVAHI_CLIENT_DISCONNECTED = 100, /**< Lost DBUS connection to the Avahi daemon */
+ AVAHI_CLIENT_FAILURE = 101 /**< Some kind of error happened on the client side */
} AvahiClientState;
/** The function prototype for the callback of an AvahiClient */
AVAHI_C_DECL_BEGIN
-#ifdef __GNUC__
-#if __GNUC__ >= 4
+#if defined(__GNUC__) && (__GNUC__ >= 4)
#define AVAHI_GCC_SENTINEL __attribute__ ((sentinel))
-#endif
-#endif
-
-#ifndef AVAHI_GCC_SENTINEL
+#else
/** Macro for usage of GCC's sentinel compilation warnings */
#define AVAHI_GCC_SENTINEL
#endif
return;
switch (state) {
+ case AVAHI_CLIENT_FAILURE:
case AVAHI_CLIENT_DISCONNECTED:
reg_report_status(data, SW_DISCOVERY_PUBLISH_INVALID);
break;
assert(sdref->n_ref >= 1);
switch (state) {
-
+
+ case AVAHI_CLIENT_FAILURE:
case AVAHI_CLIENT_DISCONNECTED:
if (sdref->service_browser_callback)
return;
switch (state) {
+ case AVAHI_CLIENT_FAILURE:
case AVAHI_CLIENT_DISCONNECTED:
reg_report_error(sdref, kDNSServiceErr_Unknown);
break;
n_all_for_now++;
}
-static void client_callback(AVAHI_GCC_UNUSED AvahiClient *c, AvahiClientState state, AVAHI_GCC_UNUSED void * userdata) {
+static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UNUSED void * userdata) {
switch (state) {
+ case AVAHI_CLIENT_FAILURE:
+ fprintf(stderr, "Client failure, exiting: %s\n", avahi_strerror(avahi_client_errno(c)));
+ avahi_simple_poll_quit(simple_poll);
+ break;
+
case AVAHI_CLIENT_DISCONNECTED:
fprintf(stderr, "Client disconnected, exiting.\n");
avahi_simple_poll_quit(simple_poll);
break;
+ case AVAHI_CLIENT_FAILURE:
+
+ fprintf(stderr, "Client failure: %s\n", avahi_strerror(avahi_client_errno(c)));
+ avahi_simple_poll_quit(simple_poll);
+
+ break;
+
case AVAHI_CLIENT_S_REGISTERING:
;
}