diff --git a/moonlight-common/.classpath b/moonlight-common/.classpath index 54e8ab3d..b69f9e53 100644 --- a/moonlight-common/.classpath +++ b/moonlight-common/.classpath @@ -3,9 +3,9 @@ - + diff --git a/moonlight-common/libs/jmdns-3.4.2.jar b/moonlight-common/libs/jmdns-3.4.2.jar new file mode 100644 index 00000000..3112053f Binary files /dev/null and b/moonlight-common/libs/jmdns-3.4.2.jar differ diff --git a/moonlight-common/libs/jmdns-fixed.jar b/moonlight-common/libs/jmdns-fixed.jar deleted file mode 100644 index b003773c..00000000 Binary files a/moonlight-common/libs/jmdns-fixed.jar and /dev/null differ diff --git a/moonlight-common/patches/jmdns-3.4.1-changes.patch b/moonlight-common/patches/jmdns-3.4.1-changes.patch deleted file mode 100644 index 1f757312..00000000 --- a/moonlight-common/patches/jmdns-3.4.1-changes.patch +++ /dev/null @@ -1,31 +0,0 @@ -Index: build.xml -=================================================================== ---- build.xml (revision 353) -+++ build.xml (working copy) -@@ -58,7 +58,7 @@ - - - -- -+ - - - -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; - } diff --git a/moonlight-common/src/com/limelight/nvstream/mdns/MdnsDiscoveryAgent.java b/moonlight-common/src/com/limelight/nvstream/mdns/MdnsDiscoveryAgent.java index af59f328..b85484a2 100644 --- a/moonlight-common/src/com/limelight/nvstream/mdns/MdnsDiscoveryAgent.java +++ b/moonlight-common/src/com/limelight/nvstream/mdns/MdnsDiscoveryAgent.java @@ -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 computers; private MdnsDiscoveryListener listener; private HashSet 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 pendingNames = new ArrayList(pendingResolution); for (String name : pendingNames) { LimeLog.info("mDNS: Retrying service resolution for machine: "+name); - resolver.getServiceInfo(SERVICE_TYPE, name); + resolver.requestServiceInfo(SERVICE_TYPE, name); } } }