]> git.meshlink.io Git - catta/commitdiff
* Rename AVAHI_ERR_NOT_CONNECTED to AVAHI_ERR_DISCONNECTED
authorLennart Poettering <lennart@poettering.net>
Sun, 6 Nov 2005 16:12:03 +0000 (16:12 +0000)
committerLennart Poettering <lennart@poettering.net>
Sun, 6 Nov 2005 16:12:03 +0000 (16:12 +0000)
* 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

17 files changed:
avahi-client/browser.c
avahi-client/client.c
avahi-client/client.h
avahi-client/entrygroup.c
avahi-client/resolver.c
avahi-common/dbus.c
avahi-common/dbus.h
avahi-common/error.c
avahi-common/error.h
avahi-compat-howl/compat.c
avahi-compat-libdns_sd/compat.c
avahi-utils/avahi-browse.c
avahi-utils/avahi-resolve-host-name.c
docs/TODO
examples/client-browse-services.c
examples/client-publish-service.c
examples/glib-integration.c

index 1ac2e200f9fa505de801b1e3809f2905815892da..bf9c15f00652877966e03440dbba51faa142cb12 100644 (file)
@@ -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);
index d4faed039ffbe551a017610a92bcc8012b84047a..ef773663c817ce8527e117d5f719ad7d3b216302 100644 (file)
@@ -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;
     }
index 36bf7cdddaefba8278bdfac464a310e841b16f40..3e18fcaa0713375d93525f4b682313f01e6ab0e0 100644 (file)
@@ -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 */
index 50afb126c41589f873fb1762b26a60ce2ff24049..4c5c91444098c46ada2d2964818f113fdc8a7cfa 100644 (file)
@@ -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);
index d06c43c7ba3cd808a0a4addcfda19974a3f455f8..23011342e87de9df0cbc9ee395e7bba91ceaa4ee 100644 (file)
@@ -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);
index 3ea7cbd40e2a8e9c5d146e2bc08784704895589b..fc4b34b895a3aa8fafb67358ae96a4a4680401a2 100644 (file)
@@ -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,
index fb8a074fbe3e5b81a1215d6907dc194243ee2b87..f28b48a6ef53d7e52dc7fe033f7a41837a1c0949 100644 (file)
@@ -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"
index 864a5bd1c992e284d0eeabcf2ec168c53f560b5d..6c0a9000dbc18872fd0de29be6122d65f5f3aebf 100644 (file)
@@ -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",
index 91e32d7eade56f4abbf92e393af64db2595241e2..d6c46205ab2fad74cf2ab60306371f870c7b76cb 100644 (file)
@@ -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 */
index 8db8fe0233b33edad01ae0539390871c68015821..12f22fafb81815a56c024c4bdd5d1fcfc84aab1c 100644 (file)
@@ -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;
         
index 6fec3c96b40ee8bcfbc406bf478426f5af5d83cc..432bb382d6a0648f4969e601dd6e37fa1b45d44a 100644 (file)
@@ -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;
 
index b8910fcb720981266e66023a609b9d395bd789ca..38460f3517d2822be84835fddd8038b5d34f48ab 100644 (file)
@@ -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:
index 6a35f1b383b0bceb15fbe209105de3d50564522d..2a65f750012532f05805d5355225f42305d49df9 100644 (file)
@@ -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:
index 1e29b1197fd35865e9a1e691af1f439f1ac17060..965641ecb3b3cd350af77f0254b429b3fb508990 100644 (file)
--- 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
index c5a1cbd978f3930a7b5cee6a63a66b2054130edf..00703e61b316152c128f0c8a55ec633c2d099936 100644 (file)
@@ -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);
     }
 }
index 2f126c173090e33b5d9dde77658e28b48f3bcd04..50a7002b0772f8d0adec60f97a6547dbeb950029 100644 (file)
@@ -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)));
index bf6eacf6139ca77da04548f79135d7d00205eb86..f1830d86134d77f10a911680a0588c82c753ebd0 100644 (file)
@@ -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);