mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-20 03:23:07 +00:00
Fix concurrent modification race in pendingResolutions hash map
This commit is contained in:
parent
d3be670974
commit
756ceaff1a
@ -152,7 +152,9 @@ public class MdnsDiscoveryAgent implements ServiceListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void handleResolvedServiceInfo(ServiceInfo info) {
|
private void handleResolvedServiceInfo(ServiceInfo info) {
|
||||||
pendingResolution.remove(info.getName());
|
synchronized (pendingResolution) {
|
||||||
|
pendingResolution.remove(info.getName());
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
handleServiceInfo(info);
|
handleServiceInfo(info);
|
||||||
@ -202,7 +204,10 @@ public class MdnsDiscoveryAgent implements ServiceListener {
|
|||||||
resolver.requestServiceInfo(SERVICE_TYPE, null, discoveryIntervalMs);
|
resolver.requestServiceInfo(SERVICE_TYPE, null, discoveryIntervalMs);
|
||||||
|
|
||||||
// Run service resolution again for pending machines
|
// Run service resolution again for pending machines
|
||||||
ArrayList<String> pendingNames = new ArrayList<String>(pendingResolution);
|
ArrayList<String> pendingNames;
|
||||||
|
synchronized (pendingResolution) {
|
||||||
|
pendingNames = new ArrayList<String>(pendingResolution);
|
||||||
|
}
|
||||||
for (String name : pendingNames) {
|
for (String name : pendingNames) {
|
||||||
LimeLog.info("mDNS: Retrying service resolution for machine: "+name);
|
LimeLog.info("mDNS: Retrying service resolution for machine: "+name);
|
||||||
ServiceInfo[] infos = resolver.getServiceInfos(SERVICE_TYPE, name, 500);
|
ServiceInfo[] infos = resolver.getServiceInfos(SERVICE_TYPE, name, 500);
|
||||||
@ -258,7 +263,9 @@ public class MdnsDiscoveryAgent implements ServiceListener {
|
|||||||
ServiceInfo info = event.getDNS().getServiceInfo(SERVICE_TYPE, event.getInfo().getName(), 500);
|
ServiceInfo info = event.getDNS().getServiceInfo(SERVICE_TYPE, event.getInfo().getName(), 500);
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
// This machine is pending resolution
|
// This machine is pending resolution
|
||||||
pendingResolution.add(event.getInfo().getName());
|
synchronized (pendingResolution) {
|
||||||
|
pendingResolution.add(event.getInfo().getName());
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user