mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-21 20:13:06 +00:00
Remove init hack in DiscoveryService
This commit is contained in:
parent
0f4e5a4585
commit
825233309d
Binary file not shown.
@ -1,6 +1,5 @@
|
||||
package com.limelight.discovery;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import com.limelight.nvstream.mdns.MdnsComputer;
|
||||
@ -47,14 +46,7 @@ public class DiscoveryService extends Service {
|
||||
multicastLock = wifiMgr.createMulticastLock("Limelight mDNS");
|
||||
multicastLock.setReferenceCounted(false);
|
||||
|
||||
// This pattern is nasty. We have to do it
|
||||
// because we can't do network on the main thread
|
||||
// even if it's non-blocking
|
||||
Thread initThread = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
discoveryAgent = MdnsDiscoveryAgent.createDiscoveryAgent(new MdnsDiscoveryListener() {
|
||||
discoveryAgent = new MdnsDiscoveryAgent(new MdnsDiscoveryListener() {
|
||||
@Override
|
||||
public void notifyComputerAdded(MdnsComputer computer) {
|
||||
if (boundListener != null) {
|
||||
@ -76,32 +68,15 @@ public class DiscoveryService extends Service {
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
discoveryAgent = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
initThread.start();
|
||||
try {
|
||||
initThread.join();
|
||||
} catch (InterruptedException e) {
|
||||
discoveryAgent = null;
|
||||
}
|
||||
}
|
||||
|
||||
private DiscoveryBinder binder = new DiscoveryBinder();
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
// We should only be bindable if discovery can happen
|
||||
if (discoveryAgent != null) {
|
||||
return binder;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onUnbind(Intent intent) {
|
||||
// Stop any discovery session
|
||||
|
Loading…
x
Reference in New Issue
Block a user