]> git.meshlink.io Git - catta/blobdiff - examples/client-browse-services.c
* add new entry group state AVAHI_ENTRY_GROUP_FAILURE
[catta] / examples / client-browse-services.c
index 7918cade7d3c346236ba882cf2a315c947c36d4a..5ebbf2d89dc5981fe3dd72d50dcaf2fc1f20521d 100644 (file)
@@ -62,7 +62,7 @@ static void resolve_callback(
             break;
 
         case AVAHI_RESOLVER_FOUND: {
-            char a[128], *t;
+            char a[AVAHI_ADDRESS_STR_MAX], *t;
             
             fprintf(stderr, "Service '%s' of type '%s' in domain '%s':\n", name, type, domain);
             
@@ -73,13 +73,15 @@ static void resolve_callback(
                     "\tTXT=%s\n"
                     "\tcookie is %u\n"
                     "\tis_local: %i\n"
+                    "\tour_own: %i\n"
                     "\twide_area: %i\n"
                     "\tmulticast: %i\n"
                     "\tcached: %i\n",
                     host_name, port, a,
                     t,
                     avahi_string_list_get_service_cookie(txt),
-                    avahi_client_is_service_local(avahi_service_resolver_get_client(r), interface, protocol, name, type, domain),
+                    !!(flags & AVAHI_LOOKUP_RESULT_LOCAL),
+                    !!(flags & AVAHI_LOOKUP_RESULT_OUR_OWN),
                     !!(flags & AVAHI_LOOKUP_RESULT_WIDE_AREA),
                     !!(flags & AVAHI_LOOKUP_RESULT_MULTICAST),
                     !!(flags & AVAHI_LOOKUP_RESULT_CACHED));
@@ -176,11 +178,9 @@ int main(int argc, char*argv[]) {
         fprintf(stderr, "Failed to create service browser: %s\n", avahi_strerror(avahi_client_errno(client)));
         goto fail;
     }
-    
+
     /* Run the main loop */
-    for (;;)
-        if (avahi_simple_poll_iterate(simple_poll, -1) != 0)
-            break;
+    avahi_simple_poll_loop(simple_poll);
     
     ret = 0;