2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-30 13:47:41 +00:00

Remove reverseConnectionBlackList used to support Android < 4

This commit is contained in:
Albert Vaca Cintora 2023-06-14 18:17:18 +02:00
parent 1ef3d75eb1
commit 81270f724d

View File

@ -35,8 +35,6 @@ import java.net.SocketException;
import java.security.cert.Certificate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Timer;
import java.util.TimerTask;
import javax.net.SocketFactory;
import javax.net.ssl.SSLSocket;
@ -69,9 +67,6 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis
private boolean listening = false;
// To prevent infinite loop between Android < IceCream because both device can only broadcast identity packet but cannot connect via TCP
private final ArrayList<InetAddress> reverseConnectionBlackList = new ArrayList<>();
@Override // SocketClosedCallback
public void linkDisconnected(LanLink brokenLink) {
String deviceId = brokenLink.getDeviceId();
@ -140,19 +135,8 @@ public class LanLinkProvider extends BaseLinkProvider implements LanLink.LinkDis
} catch (Exception e) {
Log.e("KDE/LanLinkProvider", "Cannot connect to " + address, e);
if (!reverseConnectionBlackList.contains(address)) {
Log.w("KDE/LanLinkProvider", "Blacklisting " + address);
reverseConnectionBlackList.add(address);
new Timer().schedule(new TimerTask() {
@Override
public void run() {
reverseConnectionBlackList.remove(address);
}
}, 5 * 1000);
// Try to cause a reverse connection
onNetworkChange();
}
// Broadcast our identity packet to see if we get a reverse connection
onNetworkChange();
}
}