From: Lennart Poettering Date: Sun, 6 Nov 2005 16:12:03 +0000 (+0000) Subject: * Rename AVAHI_ERR_NOT_CONNECTED to AVAHI_ERR_DISCONNECTED X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=4e2113a7d5b702ff070e8220b32662bb00ae02dd;p=catta * Rename AVAHI_ERR_NOT_CONNECTED to AVAHI_ERR_DISCONNECTED * Remove client state AVAHI_CLIENT_DISCONNECTED and replace it with AVAHI_CLIENT_FAILURE with error code set to AVAHI_ERR_DISCONNECTED git-svn-id: file:///home/lennart/svn/public/avahi/trunk@935 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- diff --git a/avahi-client/browser.c b/avahi-client/browser.c index 1ac2e20..bf9c15f 100644 --- a/avahi-client/browser.c +++ b/avahi-client/browser.c @@ -125,7 +125,7 @@ AvahiDomainBrowser* avahi_domain_browser_new( dbus_error_init (&error); - if (client->state == AVAHI_CLIENT_DISCONNECTED) { + if (client->state == AVAHI_CLIENT_FAILURE) { avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE); goto fail; } @@ -248,7 +248,7 @@ int avahi_domain_browser_free (AvahiDomainBrowser *b) { client = b->client; - if (b->path && client->state != AVAHI_CLIENT_DISCONNECTED) + if (b->path && client->state != AVAHI_CLIENT_FAILURE) r = avahi_client_simple_method_call(client, b->path, AVAHI_DBUS_INTERFACE_DOMAIN_BROWSER, "Free"); AVAHI_LLIST_REMOVE(AvahiDomainBrowser, domain_browsers, client->domain_browsers, b); @@ -367,7 +367,7 @@ AvahiServiceTypeBrowser* avahi_service_type_browser_new( dbus_error_init(&error); - if (client->state == AVAHI_CLIENT_DISCONNECTED) { + if (client->state == AVAHI_CLIENT_FAILURE) { avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE); goto fail; } @@ -473,7 +473,7 @@ int avahi_service_type_browser_free (AvahiServiceTypeBrowser *b) { assert(b); client = b->client; - if (b->path && client->state != AVAHI_CLIENT_DISCONNECTED) + if (b->path && client->state != AVAHI_CLIENT_FAILURE) r = avahi_client_simple_method_call(client, b->path, AVAHI_DBUS_INTERFACE_SERVICE_TYPE_BROWSER, "Free"); AVAHI_LLIST_REMOVE(AvahiServiceTypeBrowser, service_type_browsers, b->client->service_type_browsers, b); @@ -583,7 +583,7 @@ AvahiServiceBrowser* avahi_service_browser_new( dbus_error_init(&error); - if (client->state == AVAHI_CLIENT_DISCONNECTED) { + if (client->state == AVAHI_CLIENT_FAILURE) { avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE); goto fail; } @@ -694,7 +694,7 @@ int avahi_service_browser_free (AvahiServiceBrowser *b) { assert(b); client = b->client; - if (b->path && client->state != AVAHI_CLIENT_DISCONNECTED) + if (b->path && client->state != AVAHI_CLIENT_FAILURE) r = avahi_client_simple_method_call(client, b->path, AVAHI_DBUS_INTERFACE_SERVICE_BROWSER, "Free"); AVAHI_LLIST_REMOVE(AvahiServiceBrowser, service_browsers, b->client->service_browsers, b); diff --git a/avahi-client/client.c b/avahi-client/client.c index d4faed0..ef77366 100644 --- a/avahi-client/client.c +++ b/avahi-client/client.c @@ -61,7 +61,6 @@ static void client_set_state (AvahiClient *client, AvahiServerState state) { client->state = state; switch (client->state) { - case AVAHI_CLIENT_DISCONNECTED: case AVAHI_CLIENT_FAILURE: if (client->bus) { dbus_connection_disconnect(client->bus); @@ -107,13 +106,14 @@ static DBusHandlerResult filter_func(DBusConnection *bus, DBusMessage *message, /* dbus_message_get_path (message), */ /* dbus_message_get_member (message)); */ - if (client->state == AVAHI_CLIENT_DISCONNECTED) + if (client->state == AVAHI_CLIENT_FAILURE) goto fail; if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, "Disconnected")) { /* The DBUS server died or kicked us */ - client_set_state(client, AVAHI_CLIENT_DISCONNECTED); + avahi_client_set_errno(client, AVAHI_ERR_DISCONNECTED); + client_set_state(client, AVAHI_CLIENT_FAILURE); } if (dbus_message_is_signal(message, DBUS_INTERFACE_DBUS, "NameOwnerChanged")) { char *name, *old, *new; @@ -129,13 +129,15 @@ static DBusHandlerResult filter_func(DBusConnection *bus, DBusMessage *message, goto fail; } - if (strcmp(name, AVAHI_DBUS_NAME) == 0) + if (strcmp(name, AVAHI_DBUS_NAME) == 0) { /* Regardless if the server lost or acquired its name or * if the name was transfered: our services are no longer * available, so we disconnect ourselves */ - - client_set_state(client, AVAHI_CLIENT_DISCONNECTED); + + avahi_client_set_errno(client, AVAHI_ERR_DISCONNECTED); + client_set_state(client, AVAHI_CLIENT_FAILURE); + } } else if (dbus_message_is_signal (message, AVAHI_DBUS_INTERFACE_SERVER, "StateChanged")) { int32_t state; @@ -387,7 +389,7 @@ AvahiClient *avahi_client_new(const AvahiPoll *poll_api, AvahiClientCallback cal client->error = AVAHI_OK; client->callback = callback; client->userdata = userdata; - client->state = AVAHI_CLIENT_DISCONNECTED; + client->state = AVAHI_CLIENT_FAILURE; client->host_name = NULL; client->host_name_fqdn = NULL; @@ -577,7 +579,7 @@ fail: const char* avahi_client_get_version_string (AvahiClient *client) { assert(client); - if (client->state == AVAHI_CLIENT_DISCONNECTED) { + if (client->state == AVAHI_CLIENT_FAILURE) { avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE); return NULL; } @@ -591,7 +593,7 @@ const char* avahi_client_get_version_string (AvahiClient *client) { const char* avahi_client_get_domain_name (AvahiClient *client) { assert(client); - if (client->state == AVAHI_CLIENT_DISCONNECTED) { + if (client->state == AVAHI_CLIENT_FAILURE) { avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE); return NULL; } @@ -605,7 +607,7 @@ const char* avahi_client_get_domain_name (AvahiClient *client) { const char* avahi_client_get_host_name (AvahiClient *client) { assert(client); - if (client->state == AVAHI_CLIENT_DISCONNECTED) { + if (client->state == AVAHI_CLIENT_FAILURE) { avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE); return NULL; } @@ -619,7 +621,7 @@ const char* avahi_client_get_host_name (AvahiClient *client) { const char* avahi_client_get_host_name_fqdn (AvahiClient *client) { assert(client); - if (client->state == AVAHI_CLIENT_DISCONNECTED) { + if (client->state == AVAHI_CLIENT_FAILURE) { avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE); return NULL; } @@ -697,7 +699,7 @@ uint32_t avahi_client_get_local_service_cookie(AvahiClient *client) { DBusError error; assert(client); - if (client->state == AVAHI_CLIENT_DISCONNECTED) { + if (client->state == AVAHI_CLIENT_FAILURE) { avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE); return AVAHI_SERVICE_COOKIE_INVALID; } diff --git a/avahi-client/client.h b/avahi-client/client.h index 36bf7cd..3e18fca 100644 --- a/avahi-client/client.h +++ b/avahi-client/client.h @@ -46,8 +46,7 @@ typedef enum { 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 */ + AVAHI_CLIENT_FAILURE = 100 /**< Some kind of error happened on the client side */ } AvahiClientState; /** The function prototype for the callback of an AvahiClient */ diff --git a/avahi-client/entrygroup.c b/avahi-client/entrygroup.c index 50afb12..4c5c914 100644 --- a/avahi-client/entrygroup.c +++ b/avahi-client/entrygroup.c @@ -111,7 +111,7 @@ AvahiEntryGroup* avahi_entry_group_new (AvahiClient *client, AvahiEntryGroupCall dbus_error_init (&error); - if (client->state == AVAHI_CLIENT_DISCONNECTED) { + if (client->state == AVAHI_CLIENT_FAILURE) { avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE); goto fail; } @@ -237,7 +237,7 @@ int avahi_entry_group_free(AvahiEntryGroup *group) { assert(group); - if (group->path && client->state != AVAHI_CLIENT_DISCONNECTED) + if (group->path && client->state != AVAHI_CLIENT_FAILURE) r = entry_group_simple_method_call(group, "Free"); AVAHI_LLIST_REMOVE(AvahiEntryGroup, groups, client->groups, group); @@ -251,7 +251,7 @@ int avahi_entry_group_free(AvahiEntryGroup *group) { int avahi_entry_group_commit(AvahiEntryGroup *group) { assert(group); - if (!group->path || group->client->state == AVAHI_CLIENT_DISCONNECTED) + if (!group->path || group->client->state == AVAHI_CLIENT_FAILURE) return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE); return entry_group_simple_method_call(group, "Commit"); @@ -260,7 +260,7 @@ int avahi_entry_group_commit(AvahiEntryGroup *group) { int avahi_entry_group_reset(AvahiEntryGroup *group) { assert(group); - if (!group->path || group->client->state == AVAHI_CLIENT_DISCONNECTED) + if (!group->path || group->client->state == AVAHI_CLIENT_FAILURE) return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE); return entry_group_simple_method_call(group, "Reset"); @@ -288,7 +288,7 @@ int avahi_entry_group_is_empty (AvahiEntryGroup *group) { assert(group); client = group->client; - if (!group->path || group->client->state == AVAHI_CLIENT_DISCONNECTED) + if (!group->path || group->client->state == AVAHI_CLIENT_FAILURE) return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE); dbus_error_init(&error); @@ -409,7 +409,7 @@ int avahi_entry_group_add_service_strlst( client = group->client; - if (!group->path || group->client->state == AVAHI_CLIENT_DISCONNECTED) + if (!group->path || group->client->state == AVAHI_CLIENT_FAILURE) return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE); if (!domain) @@ -528,7 +528,7 @@ int avahi_entry_group_add_service_subtype( client = group->client; - if (!group->path || group->client->state == AVAHI_CLIENT_DISCONNECTED) + if (!group->path || group->client->state == AVAHI_CLIENT_FAILURE) return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE); if (!domain) @@ -638,7 +638,7 @@ int avahi_entry_group_update_service_txt_strlst( client = group->client; - if (!group->path || group->client->state == AVAHI_CLIENT_DISCONNECTED) + if (!group->path || group->client->state == AVAHI_CLIENT_FAILURE) return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE); if (!domain) @@ -726,7 +726,7 @@ int avahi_entry_group_add_address( client = group->client; - if (!group->path || group->client->state == AVAHI_CLIENT_DISCONNECTED) + if (!group->path || group->client->state == AVAHI_CLIENT_FAILURE) return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE); dbus_error_init(&error); @@ -815,7 +815,7 @@ int avahi_entry_group_add_record( client = group->client; - if (!group->path || group->client->state == AVAHI_CLIENT_DISCONNECTED) + if (!group->path || group->client->state == AVAHI_CLIENT_FAILURE) return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE); dbus_error_init(&error); diff --git a/avahi-client/resolver.c b/avahi-client/resolver.c index d06c43c..2301134 100644 --- a/avahi-client/resolver.c +++ b/avahi-client/resolver.c @@ -209,7 +209,7 @@ AvahiServiceResolver * avahi_service_resolver_new( dbus_error_init (&error); - if (client->state == AVAHI_CLIENT_DISCONNECTED) { + if (client->state == AVAHI_CLIENT_FAILURE) { avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE); goto fail; } @@ -331,7 +331,7 @@ int avahi_service_resolver_free(AvahiServiceResolver *r) { assert(r); client = r->client; - if (r->path && client->state != AVAHI_CLIENT_DISCONNECTED) + if (r->path && client->state != AVAHI_CLIENT_FAILURE) ret = avahi_client_simple_method_call(client, r->path, AVAHI_DBUS_INTERFACE_SERVICE_RESOLVER, "Free"); AVAHI_LLIST_REMOVE(AvahiServiceResolver, service_resolvers, client->service_resolvers, r); @@ -446,7 +446,7 @@ AvahiHostNameResolver * avahi_host_name_resolver_new( dbus_error_init (&error); - if (client->state == AVAHI_CLIENT_DISCONNECTED) { + if (client->state == AVAHI_CLIENT_FAILURE) { avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE); goto fail; } @@ -546,7 +546,7 @@ int avahi_host_name_resolver_free(AvahiHostNameResolver *r) { assert(r); client = r->client; - if (r->path && client->state != AVAHI_CLIENT_DISCONNECTED) + if (r->path && client->state != AVAHI_CLIENT_FAILURE) ret = avahi_client_simple_method_call(client, r->path, AVAHI_DBUS_INTERFACE_HOST_NAME_RESOLVER, "Free"); AVAHI_LLIST_REMOVE(AvahiHostNameResolver, host_name_resolvers, client->host_name_resolvers, r); @@ -669,7 +669,7 @@ AvahiAddressResolver * avahi_address_resolver_new( return NULL; } - if (client->state == AVAHI_CLIENT_DISCONNECTED) { + if (client->state == AVAHI_CLIENT_FAILURE) { avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE); goto fail; } @@ -768,7 +768,7 @@ int avahi_address_resolver_free(AvahiAddressResolver *r) { assert(r); client = r->client; - if (r->path && client->state != AVAHI_CLIENT_DISCONNECTED) + if (r->path && client->state != AVAHI_CLIENT_FAILURE) ret = avahi_client_simple_method_call(client, r->path, AVAHI_DBUS_INTERFACE_ADDRESS_RESOLVER, "Free"); AVAHI_LLIST_REMOVE(AvahiAddressResolver, address_resolvers, client->address_resolvers, r); diff --git a/avahi-common/dbus.c b/avahi-common/dbus.c index 3ea7cbd..fc4b34b 100644 --- a/avahi-common/dbus.c +++ b/avahi-common/dbus.c @@ -56,7 +56,7 @@ static const char * const table[- AVAHI_ERR_MAX] = { AVAHI_DBUS_ERR_ACCESS_DENIED, AVAHI_DBUS_ERR_INVALID_OPERATION, AVAHI_DBUS_ERR_DBUS_ERROR, - AVAHI_DBUS_ERR_NOT_CONNECTED, + AVAHI_DBUS_ERR_DISCONNECTED, AVAHI_DBUS_ERR_NO_MEMORY, AVAHI_DBUS_ERR_INVALID_OBJECT, AVAHI_DBUS_ERR_NO_DAEMON, diff --git a/avahi-common/dbus.h b/avahi-common/dbus.h index fb8a074..f28b48a 100644 --- a/avahi-common/dbus.h +++ b/avahi-common/dbus.h @@ -65,7 +65,7 @@ AVAHI_C_DECL_BEGIN #define AVAHI_DBUS_ERR_ACCESS_DENIED DBUS_ERROR_ACCESS_DENIED #define AVAHI_DBUS_ERR_INVALID_OPERATION "org.freedesktop.Avahi.InvalidOperationError" #define AVAHI_DBUS_ERR_DBUS_ERROR "org.freedesktop.Avahi.DBusError" -#define AVAHI_DBUS_ERR_NOT_CONNECTED "org.freedesktop.Avahi.NotConnectedError" +#define AVAHI_DBUS_ERR_DISCONNECTED "org.freedesktop.Avahi.DisconnectedError" #define AVAHI_DBUS_ERR_NO_MEMORY "org.freedesktop.Avahi.NoMemoryError" #define AVAHI_DBUS_ERR_INVALID_OBJECT "org.freedesktop.Avahi.InvalidObjectError" #define AVAHI_DBUS_ERR_NO_DAEMON "org.freedesktop.Avahi.NoDaemonError" diff --git a/avahi-common/error.c b/avahi-common/error.c index 864a5bd..6c0a900 100644 --- a/avahi-common/error.c +++ b/avahi-common/error.c @@ -53,7 +53,7 @@ const char *avahi_strerror(int error) { "Access denied", "Invalid operation", "An unexpected DBUS error occured", - "Could not get a connection to the daemon", + "Daemon connection failed", "Memory exhausted", "The object passed in was not valid", "Daemon not running", diff --git a/avahi-common/error.h b/avahi-common/error.h index 91e32d7..d6c4620 100644 --- a/avahi-common/error.h +++ b/avahi-common/error.h @@ -55,7 +55,7 @@ enum { AVAHI_ERR_ACCESS_DENIED = -20, /**< Access denied */ AVAHI_ERR_INVALID_OPERATION = -21, /**< Invalid operation */ AVAHI_ERR_DBUS_ERROR = -22, /**< An unexpected DBUS error occured */ - AVAHI_ERR_NOT_CONNECTED = -23, /**< Could not get a connection to the daemon */ + AVAHI_ERR_DISCONNECTED = -23, /**< Daemon connection failed */ AVAHI_ERR_NO_MEMORY = -24, /**< Memory exhausted */ AVAHI_ERR_INVALID_OBJECT = -25, /**< The object passed to this function was invalid */ AVAHI_ERR_NO_DAEMON = -26, /**< Daemon not running */ diff --git a/avahi-compat-howl/compat.c b/avahi-compat-howl/compat.c index 8db8fe0..12f22fa 100644 --- a/avahi-compat-howl/compat.c +++ b/avahi-compat-howl/compat.c @@ -695,7 +695,6 @@ static void reg_client_callback(oid_data *data, AvahiClientState state) { switch (state) { case AVAHI_CLIENT_FAILURE: - case AVAHI_CLIENT_DISCONNECTED: reg_report_status(data, SW_DISCOVERY_PUBLISH_INVALID); break; diff --git a/avahi-compat-libdns_sd/compat.c b/avahi-compat-libdns_sd/compat.c index 6fec3c9..432bb38 100644 --- a/avahi-compat-libdns_sd/compat.c +++ b/avahi-compat-libdns_sd/compat.c @@ -145,7 +145,7 @@ static DNSServiceErrorType map_error(int error) { case AVAHI_ERR_INVALID_CONFIG: case AVAHI_ERR_TIMEOUT: case AVAHI_ERR_DBUS_ERROR: - case AVAHI_ERR_NOT_CONNECTED: + case AVAHI_ERR_DISCONNECTED: case AVAHI_ERR_NO_DAEMON: break; @@ -481,7 +481,6 @@ static void generic_client_callback(AvahiClient *s, AvahiClientState state, void switch (state) { case AVAHI_CLIENT_FAILURE: - case AVAHI_CLIENT_DISCONNECTED: if (sdref->service_browser_callback) sdref->service_browser_callback(sdref, 0, 0, error, NULL, NULL, NULL, sdref->context); @@ -862,7 +861,6 @@ static void reg_client_callback(AvahiClient *s, AvahiClientState state, void* us switch (state) { case AVAHI_CLIENT_FAILURE: - case AVAHI_CLIENT_DISCONNECTED: reg_report_error(sdref, kDNSServiceErr_Unknown); break; diff --git a/avahi-utils/avahi-browse.c b/avahi-utils/avahi-browse.c index b8910fc..38460f3 100644 --- a/avahi-utils/avahi-browse.c +++ b/avahi-utils/avahi-browse.c @@ -480,11 +480,6 @@ static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UN 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_S_REGISTERING: case AVAHI_CLIENT_S_RUNNING: case AVAHI_CLIENT_S_COLLISION: diff --git a/avahi-utils/avahi-resolve-host-name.c b/avahi-utils/avahi-resolve-host-name.c index 6a35f1b..2a65f75 100644 --- a/avahi-utils/avahi-resolve-host-name.c +++ b/avahi-utils/avahi-resolve-host-name.c @@ -148,11 +148,6 @@ static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UN 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_S_REGISTERING: case AVAHI_CLIENT_S_RUNNING: case AVAHI_CLIENT_S_COLLISION: diff --git a/docs/TODO b/docs/TODO index 1e29b11..965641e 100644 --- a/docs/TODO +++ b/docs/TODO @@ -7,7 +7,6 @@ for 0.6: * update man pages later: -* avahi-client: do something about letting the client know if the daemon comes back from a DISCONNECTED state * add simplification routine for adding services * implement avahi-utils in C * support for special domain PTR records based on local IP subnet address diff --git a/examples/client-browse-services.c b/examples/client-browse-services.c index c5a1cbd..00703e6 100644 --- a/examples/client-browse-services.c +++ b/examples/client-browse-services.c @@ -145,8 +145,8 @@ static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UN /* Called whenever the client or server state changes */ - if (state == AVAHI_CLIENT_DISCONNECTED) { - fprintf(stderr, "Server connection terminated.\n"); + if (state == AVAHI_CLIENT_FAILURE) { + fprintf(stderr, "Server connection failre: %s\n", avahi_strerror(avahi_client_errno(c))); avahi_simple_poll_quit(simple_poll); } } diff --git a/examples/client-publish-service.c b/examples/client-publish-service.c index 2f126c1..50a7002 100644 --- a/examples/client-publish-service.c +++ b/examples/client-publish-service.c @@ -150,13 +150,6 @@ static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UN avahi_entry_group_reset(group); break; - case AVAHI_CLIENT_DISCONNECTED: - - fprintf(stderr, "Server connection terminated.\n"); - avahi_simple_poll_quit(simple_poll); - - break; - case AVAHI_CLIENT_FAILURE: fprintf(stderr, "Client failure: %s\n", avahi_strerror(avahi_client_errno(c))); diff --git a/examples/glib-integration.c b/examples/glib-integration.c index bf6eacf..f1830d8 100644 --- a/examples/glib-integration.c +++ b/examples/glib-integration.c @@ -60,10 +60,10 @@ avahi_client_callback (AVAHI_GCC_UNUSED AvahiClient *client, AvahiClientState st g_message ("Avahi Client State Change: %d", state); - if (state == AVAHI_CLIENT_DISCONNECTED) + if (state == AVAHI_CLIENT_FAILURE) { /* We we're disconnected from the Daemon */ - g_message ("Disconnected from the Avahi Daemon"); + g_message ("Disconnected from the Avahi Daemon: %s", avahi_strerror(avahi_client_errno(client))); /* Quit the application */ g_main_loop_quit (loop);