cups/cups-avahi-browse.patch

47 lines
1.3 KiB
Diff
Raw Normal View History

diff -up cups-1.7.1/backend/dnssd.c.avahi-browse cups-1.7.1/backend/dnssd.c
--- cups-1.7.1/backend/dnssd.c.avahi-browse 2012-12-12 20:54:21.000000000 +0000
+++ cups-1.7.1/backend/dnssd.c 2014-02-11 12:44:54.785319324 +0000
@@ -95,6 +95,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 */
@@ -345,6 +346,7 @@ main(int argc, /* I - Number of comm
return (1);
}
+ browsers = 6;
avahi_service_browser_new(client, AVAHI_IF_UNSPEC,
AVAHI_PROTO_UNSPEC,
"_fax-ipp._tcp", NULL, 0,
@@ -559,7 +561,11 @@ main(int argc, /* I - Number of comm
fprintf(stderr, "DEBUG: sent=%d, count=%d\n", sent, count);
if (sent == cupsArrayCount(devices))
- break;
+#ifdef HAVE_AVAHI
+ if (browsers == 0)
+ /* All service browsers have finished */
+#endif /* HAVE_AVAHI */
+ break;
}
}
@@ -710,9 +716,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;
}
}