2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-29 13:17:43 +00:00

Don't connect to myself

This commit is contained in:
Albert Vaca 2013-08-07 19:14:17 +02:00
parent a9c137cf98
commit ec7333dc9a
2 changed files with 8 additions and 2 deletions

View File

@ -145,6 +145,11 @@ public class BroadcastTcpLinkProvider extends BaseLinkProvider {
if (!np.getType().equals(NetworkPackage.PACKAGE_TYPE_IDENTITY)) { if (!np.getType().equals(NetworkPackage.PACKAGE_TYPE_IDENTITY)) {
Log.e("BroadcastTcpLinkProvider", "1 Expecting an identity package"); Log.e("BroadcastTcpLinkProvider", "1 Expecting an identity package");
return; return;
} else {
String myId = NetworkPackage.createIdentityPackage(context).getString("deviceId");
if (np.getType().equals(myId)) {
return;
}
} }
Log.e("BroadcastTcpLinkProvider", "It is an identity package, creating link"); Log.e("BroadcastTcpLinkProvider", "It is an identity package, creating link");

View File

@ -104,8 +104,9 @@ public class NetworkPackage {
jo.put("version",mVersion); jo.put("version",mVersion);
} catch(Exception e) { } catch(Exception e) {
} }
Log.e("NetworkPackage.serialize",jo.toString()+"\n"); String json = jo.toString()+"\n";
return jo.toString(); Log.e("NetworkPackage.serialize",json);
return json;
} }
static public NetworkPackage unserialize(String s) { static public NetworkPackage unserialize(String s) {