From 81270f724d387dca40f213e6940d59da89869bec Mon Sep 17 00:00:00 2001 From: Albert Vaca Cintora Date: Wed, 14 Jun 2023 18:17:18 +0200 Subject: [PATCH] Remove reverseConnectionBlackList used to support Android < 4 --- .../Backends/LanBackend/LanLinkProvider.java | 20 ++----------------- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/org/kde/kdeconnect/Backends/LanBackend/LanLinkProvider.java b/src/org/kde/kdeconnect/Backends/LanBackend/LanLinkProvider.java index 6e866869..699d48c6 100644 --- a/src/org/kde/kdeconnect/Backends/LanBackend/LanLinkProvider.java +++ b/src/org/kde/kdeconnect/Backends/LanBackend/LanLinkProvider.java @@ -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 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(); } }