2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-30 21:55:10 +00:00

Using custom built Netty 4.0.25, with fix for high memory usage.

This version does not have any error, as of now and working fine

Remove timer based blacklist for reverse connection since it is not needed now
This commit is contained in:
Vineet Garg
2015-08-20 23:46:52 +05:30
parent 8556e9399e
commit 8cd59e701a
2 changed files with 1 additions and 28 deletions

Binary file not shown.

View File

@@ -21,8 +21,6 @@
package org.kde.kdeconnect.Backends.LanBackend;
import android.content.Context;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.preference.PreferenceManager;
import android.support.v4.util.LongSparseArray;
import android.util.Base64;
@@ -41,10 +39,8 @@ import java.net.InetSocketAddress;
import java.security.cert.Certificate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.TimeUnit;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLHandshakeException;
@@ -92,9 +88,6 @@ public class LanLinkProvider extends BaseLinkProvider {
private TcpHandler tcpHandler = new TcpHandler();
private UdpHandler udpHandler = new UdpHandler();
private ArrayList<String> reverseConnectionBlacklist = new ArrayList<>();
private Timer reverseConnectionTimer;
@ChannelHandler.Sharable
private class TcpHandler extends SimpleChannelInboundHandler<String>{
@Override
@@ -264,22 +257,7 @@ public class LanLinkProvider extends BaseLinkProvider {
if (!future.isSuccess()) {
Log.e("KDE/LanLinkProvider", "Cannot connect to " + identityPackage.getString("deviceId"));
// Try reverse connection
if (!reverseConnectionBlacklist.contains(identityPackage.getString("deviceId"))) {
// We are waiting for 3 seconds after trying reverse connection, to avoid any further emmission
// Without this, infinite loop is created between two devices with Android 5.0, because server will not work on it
// and it will cause trouble for ohter devices too
reverseConnectionTimer = new Timer();
reverseConnectionTimer.schedule(new TimerTask() {
@Override
public void run() {
reverseConnectionBlacklist.remove(identityPackage.getString("deviceId"));
}
}, 3*1000);
reverseConnectionBlacklist.add(identityPackage.getString("deviceId"));
onNetworkChange();
}
return;
}
@@ -430,11 +408,6 @@ public class LanLinkProvider extends BaseLinkProvider {
clientGroup = new NioEventLoopGroup();
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP) {
// Server not working in Android Lollipop due to ssl bug
return ;
}
bossGroup = new NioEventLoopGroup(1);
workerGroup = new NioEventLoopGroup();
try{