mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-18 05:39:53 +01:00
Store the UUID in the local properties so it gets sent to contacts.
This commit is contained in:
@@ -18,7 +18,6 @@ import javax.microedition.io.StreamConnection;
|
|||||||
import javax.microedition.io.StreamConnectionNotifier;
|
import javax.microedition.io.StreamConnectionNotifier;
|
||||||
|
|
||||||
import net.sf.briar.api.ContactId;
|
import net.sf.briar.api.ContactId;
|
||||||
import net.sf.briar.api.TransportConfig;
|
|
||||||
import net.sf.briar.api.TransportId;
|
import net.sf.briar.api.TransportId;
|
||||||
import net.sf.briar.api.TransportProperties;
|
import net.sf.briar.api.TransportProperties;
|
||||||
import net.sf.briar.api.plugins.StreamPlugin;
|
import net.sf.briar.api.plugins.StreamPlugin;
|
||||||
@@ -126,15 +125,15 @@ class BluetoothPlugin extends AbstractPlugin implements StreamPlugin {
|
|||||||
|
|
||||||
private synchronized String getUuid() {
|
private synchronized String getUuid() {
|
||||||
assert started;
|
assert started;
|
||||||
TransportConfig c = callback.getConfig();
|
TransportProperties p = callback.getLocalProperties();
|
||||||
String uuid = c.get("uuid");
|
String uuid = p.get("uuid");
|
||||||
if(uuid == null) {
|
if(uuid == null) {
|
||||||
// Generate a (weakly) random UUID and store it
|
// Generate a (weakly) random UUID and store it
|
||||||
byte[] b = new byte[16];
|
byte[] b = new byte[16];
|
||||||
new Random().nextBytes(b);
|
new Random().nextBytes(b);
|
||||||
uuid = StringUtils.toHexString(b);
|
uuid = StringUtils.toHexString(b);
|
||||||
c.put("uuid", uuid);
|
p.put("uuid", uuid);
|
||||||
callback.setConfig(c);
|
callback.setLocalProperties(p);
|
||||||
}
|
}
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user