2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-31 14:15:14 +00:00

Ignore udp packets on the old port for devices that know about the new port

This commit is contained in:
Albert Vaca
2016-06-16 00:37:20 +02:00
parent ced5c71369
commit e5c7adba3a
2 changed files with 6 additions and 1 deletions

View File

@@ -76,6 +76,7 @@ import io.netty.util.concurrent.GenericFutureListener;
public class LanLinkProvider extends BaseLinkProvider {
public static final int MIN_VERSION_WITH_SSL_SUPPORT = 6;
public static final int MIN_VERSION_WITH_NEW_PORT_SUPPORT = 7;
public static final String KEY_CUSTOM_DEVLIST_PREFERENCE = "device_list_preference";
@@ -275,6 +276,10 @@ public class LanLinkProvider extends BaseLinkProvider {
}
//Log.i("KDE/LanLinkProvider", "Identity package received, creating link");
if (identityPackage.getInt("protocolVersion") >= MIN_VERSION_WITH_NEW_PORT_SUPPORT && identityPackage.getInt("tcpPort") < port) {
Log.w("KDE/LanLinkProvider", "Ignoring a udp broadcast from an old port because it comes from a device which knows about the new port.");
return;
}
try{
Bootstrap bootstrap = new Bootstrap();

View File

@@ -36,7 +36,7 @@ import java.util.Set;
public class NetworkPackage {
public final static int ProtocolVersion = 6;
public final static int ProtocolVersion = 7;
public final static String PACKAGE_TYPE_IDENTITY = "kdeconnect.identity";
public final static String PACKAGE_TYPE_PAIR = "kdeconnect.pair";