From: msweet Date: Wed, 19 Feb 2014 20:15:53 +0000 (+0000) Subject: The dnssd backend did not always report all discovered printers using Avahi X-Git-Tag: v2.2b1~743 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5353e5ee0063264ee4a557a98a19a9d0a7d2b053;p=thirdparty%2Fcups.git The dnssd backend did not always report all discovered printers using Avahi (STR #4365) Keep track of active browsers, don't stop until Avahi gives up. git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@11622 a1ca3aef-8c08-0410-bb20-df032aa958be --- diff --git a/CHANGES-1.7.txt b/CHANGES-1.7.txt index 7eb27f29ea..7378cf7dfa 100644 --- a/CHANGES-1.7.txt +++ b/CHANGES-1.7.txt @@ -5,6 +5,8 @@ CHANGES IN CUPS V1.7.2 - Security: The scheduler now blocks URLs containing embedded HTML (STR #4356) + - The dnssd backend did not always report all discovered printers using + Avahi (STR #4365) - The Zebra printer driver did not properly handle negative "label top" values (STR #4354) - The scheduler did not always update the MakeModel value in diff --git a/backend/dnssd.c b/backend/dnssd.c index 44084e3ed8..bac13b0002 100644 --- a/backend/dnssd.c +++ b/backend/dnssd.c @@ -80,6 +80,7 @@ static int job_canceled = 0; static AvahiSimplePoll *simple_poll = NULL; /* Poll information */ static int got_data = 0; /* Got data from poll? */ +static int browsers = 0; /* Number of running browsers */ #endif /* HAVE_AVAHI */ @@ -330,6 +331,7 @@ main(int argc, /* I - Number of command-line args */ return (1); } + browsers = 6; avahi_service_browser_new(client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "_fax-ipp._tcp", NULL, 0, @@ -555,7 +557,11 @@ main(int argc, /* I - Number of command-line args */ fprintf(stderr, "DEBUG: sent=%d, count=%d\n", sent, count); +#ifdef HAVE_AVAHI + if (sent == cupsArrayCount(devices) && browsers == 0) +#else if (sent == cupsArrayCount(devices)) +#endif /* HAVE_AVAHI */ break; } } @@ -707,9 +713,12 @@ browse_callback( break; case AVAHI_BROWSER_REMOVE: - case AVAHI_BROWSER_ALL_FOR_NOW: case AVAHI_BROWSER_CACHE_EXHAUSTED: break; + + case AVAHI_BROWSER_ALL_FOR_NOW: + browsers--; + break; } }