File tree Expand file tree Collapse file tree
api/src/main/java/xyz/gianlu/librespot/api/handlers Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3737 */
3838public final class DiscoveryHandler implements HttpHandler {
3939 private static final Logger LOGGER = LoggerFactory .getLogger (DiscoveryHandler .class );
40- private final Zeroconf zeroconf ;
40+ private final Zeroconf . DiscoveredServices discoverer ;
4141
4242 public DiscoveryHandler () {
43- zeroconf = new Zeroconf ()
43+ Zeroconf zeroconf = new Zeroconf ()
4444 .setUseIpv4 (true )
4545 .setUseIpv6 (false );
4646
@@ -49,6 +49,8 @@ public DiscoveryHandler() {
4949 } catch (IOException ex ) {
5050 LOGGER .error ("Failed adding network interfaces for Zeroconf." , ex );
5151 }
52+
53+ discoverer = zeroconf .discover (ZeroconfServer .SERVICE , "tcp" , ".local" );
5254 }
5355
5456 @ Override
@@ -69,7 +71,7 @@ public void handleRequest(HttpServerExchange exchange) throws Exception {
6971 switch (action ) {
7072 case "list" :
7173 JsonArray array = new JsonArray ();
72- for (DiscoveredService service : zeroconf . discover ( ZeroconfServer . SERVICE , "tcp" , ".local" )) {
74+ for (DiscoveredService service : discoverer . getServices ( )) {
7375 JsonObject obj = new JsonObject ();
7476 obj .addProperty ("name" , service .name );
7577 obj .addProperty ("target" , service .target );
Original file line number Diff line number Diff line change 116116 <dependency >
117117 <groupId >xyz.gianlu.zeroconf</groupId >
118118 <artifactId >zeroconf</artifactId >
119- <version >1.2.2 </version >
119+ <version >1.3.0 </version >
120120 </dependency >
121121
122122 <!-- HTTP -->
You can’t perform that action at this time.
0 commit comments