mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-19 11:03:01 +00:00
Move to vanilla jmDNS 3.4.2 which fixes a bunch of mDNS issues and doesn't require a patch to work
This commit is contained in:
parent
63964ba6a7
commit
64aa01b2cf
@ -3,9 +3,9 @@
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="lib" path="libs/tinyrtsp.jar"/>
|
||||
<classpathentry kind="lib" path="libs/jmdns-fixed.jar"/>
|
||||
<classpathentry kind="lib" path="libs/xpp3-1.1.6.jar"/>
|
||||
<classpathentry kind="lib" path="libs/okhttp-2.4.0.jar"/>
|
||||
<classpathentry kind="lib" path="libs/okio-1.5.0.jar"/>
|
||||
<classpathentry kind="lib" path="libs/jmdns-3.4.2.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
BIN
moonlight-common/libs/jmdns-3.4.2.jar
Normal file
BIN
moonlight-common/libs/jmdns-3.4.2.jar
Normal file
Binary file not shown.
Binary file not shown.
@ -1,31 +0,0 @@
|
||||
Index: build.xml
|
||||
===================================================================
|
||||
--- build.xml (revision 353)
|
||||
+++ build.xml (working copy)
|
||||
@@ -58,7 +58,7 @@
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
- <target name="jar" depends="build,tools" description="Jar the files">
|
||||
+ <target name="jar" depends="build" description="Jar the files">
|
||||
<mkdir dir="${buildlib}" />
|
||||
<jar destfile="${buildlib}/jmdns.jar" manifest="${lib}/jmdns.manifest" basedir="${dest}">
|
||||
<fileset dir="${dest}" defaultexcludes="yes">
|
||||
Index: src/main/java/javax/jmdns/impl/tasks/resolver/ServiceInfoResolver.java
|
||||
===================================================================
|
||||
--- src/main/java/javax/jmdns/impl/tasks/resolver/ServiceInfoResolver.java (revision 353)
|
||||
+++ src/main/java/javax/jmdns/impl/tasks/resolver/ServiceInfoResolver.java (working copy)
|
||||
@@ -80,12 +80,7 @@
|
||||
protected DNSOutgoing addQuestions(DNSOutgoing out) throws IOException {
|
||||
DNSOutgoing newOut = out;
|
||||
if (!_info.hasData()) {
|
||||
- newOut = this.addQuestion(newOut, DNSQuestion.newQuestion(_info.getQualifiedName(), DNSRecordType.TYPE_SRV, DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE));
|
||||
- newOut = this.addQuestion(newOut, DNSQuestion.newQuestion(_info.getQualifiedName(), DNSRecordType.TYPE_TXT, DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE));
|
||||
- if (_info.getServer().length() > 0) {
|
||||
- newOut = this.addQuestion(newOut, DNSQuestion.newQuestion(_info.getServer(), DNSRecordType.TYPE_A, DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE));
|
||||
- newOut = this.addQuestion(newOut, DNSQuestion.newQuestion(_info.getServer(), DNSRecordType.TYPE_AAAA, DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE));
|
||||
- }
|
||||
+ newOut = this.addQuestion(newOut, DNSQuestion.newQuestion(_info.getQualifiedName(), DNSRecordType.TYPE_PTR, DNSRecordClass.CLASS_IN, DNSRecordClass.NOT_UNIQUE));
|
||||
}
|
||||
return newOut;
|
||||
}
|
@ -4,7 +4,6 @@ import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.Inet4Address;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@ -12,16 +11,16 @@ import java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import com.jmdns.JmDNS;
|
||||
import com.jmdns.ServiceEvent;
|
||||
import com.jmdns.ServiceListener;
|
||||
import javax.jmdns.JmmDNS;
|
||||
import javax.jmdns.ServiceEvent;
|
||||
import javax.jmdns.ServiceListener;
|
||||
|
||||
import com.limelight.LimeLog;
|
||||
|
||||
public class MdnsDiscoveryAgent {
|
||||
public static final String SERVICE_TYPE = "_nvstream._tcp.local.";
|
||||
|
||||
private JmDNS resolver;
|
||||
private JmmDNS resolver;
|
||||
private HashMap<InetAddress, MdnsComputer> computers;
|
||||
private MdnsDiscoveryListener listener;
|
||||
private HashSet<String> pendingResolution;
|
||||
@ -34,7 +33,7 @@ public class MdnsDiscoveryAgent {
|
||||
pendingResolution.add(event.getInfo().getName());
|
||||
|
||||
// We call this to kick the resolver
|
||||
resolver.getServiceInfo(SERVICE_TYPE, event.getInfo().getName());
|
||||
resolver.requestServiceInfo(SERVICE_TYPE, event.getInfo().getName());
|
||||
}
|
||||
|
||||
public void serviceRemoved(ServiceEvent event) {
|
||||
@ -101,43 +100,37 @@ public class MdnsDiscoveryAgent {
|
||||
|
||||
public void startDiscovery(final int discoveryIntervalMs) {
|
||||
stop = false;
|
||||
resolver = JmmDNS.Factory.getInstance();
|
||||
resolver.addServiceListener(SERVICE_TYPE, nvstreamListener);
|
||||
|
||||
final Timer t = new Timer();
|
||||
t.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
synchronized (MdnsDiscoveryAgent.this) {
|
||||
// Close the old resolver
|
||||
if (resolver != null) {
|
||||
try {
|
||||
resolver.close();
|
||||
} catch (IOException e) {}
|
||||
resolver = null;
|
||||
}
|
||||
|
||||
// Stop if requested
|
||||
if (stop) {
|
||||
// There will be no further timer invocations now
|
||||
t.cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
// Create a new resolver
|
||||
try {
|
||||
resolver = JmDNS.create(new InetSocketAddress(0).getAddress());
|
||||
} catch (IOException e) {
|
||||
// This is fine; the network is probably not up
|
||||
|
||||
// Close the resolver
|
||||
if (resolver != null) {
|
||||
try {
|
||||
resolver.close();
|
||||
} catch (IOException e) {}
|
||||
resolver = null;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Send another mDNS query
|
||||
resolver.addServiceListener(SERVICE_TYPE, nvstreamListener);
|
||||
resolver.requestServiceInfo(SERVICE_TYPE, null, discoveryIntervalMs);
|
||||
|
||||
// Run service resolution again for pending machines
|
||||
ArrayList<String> pendingNames = new ArrayList<String>(pendingResolution);
|
||||
for (String name : pendingNames) {
|
||||
LimeLog.info("mDNS: Retrying service resolution for machine: "+name);
|
||||
resolver.getServiceInfo(SERVICE_TYPE, name);
|
||||
resolver.requestServiceInfo(SERVICE_TYPE, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user