mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-22 15:49:53 +01:00
Use given transaction when adding remote properties in TransportPropertyManager.
This commit is contained in:
@@ -4,6 +4,7 @@ import org.briarproject.api.DeviceId;
|
|||||||
import org.briarproject.api.TransportId;
|
import org.briarproject.api.TransportId;
|
||||||
import org.briarproject.api.contact.ContactId;
|
import org.briarproject.api.contact.ContactId;
|
||||||
import org.briarproject.api.db.DbException;
|
import org.briarproject.api.db.DbException;
|
||||||
|
import org.briarproject.api.db.Transaction;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -13,7 +14,7 @@ public interface TransportPropertyManager {
|
|||||||
* Stores the given properties received while adding a contact - they will
|
* Stores the given properties received while adding a contact - they will
|
||||||
* be superseded by any properties synced from the contact.
|
* be superseded by any properties synced from the contact.
|
||||||
*/
|
*/
|
||||||
void addRemoteProperties(ContactId c, DeviceId dev,
|
void addRemoteProperties(Transaction txn, ContactId c, DeviceId dev,
|
||||||
Map<TransportId, TransportProperties> props) throws DbException;
|
Map<TransportId, TransportProperties> props) throws DbException;
|
||||||
|
|
||||||
/** Returns the local transport properties for all transports. */
|
/** Returns the local transport properties for all transports. */
|
||||||
|
|||||||
@@ -82,18 +82,12 @@ class TransportPropertyManagerImpl implements TransportPropertyManager,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addRemoteProperties(ContactId c, DeviceId dev,
|
public void addRemoteProperties(Transaction txn, ContactId c, DeviceId dev,
|
||||||
Map<TransportId, TransportProperties> props) throws DbException {
|
Map<TransportId, TransportProperties> props) throws DbException {
|
||||||
Transaction txn = db.startTransaction(false);
|
Group g = getContactGroup(db.getContact(txn, c));
|
||||||
try {
|
for (Entry<TransportId, TransportProperties> e : props.entrySet()) {
|
||||||
Group g = getContactGroup(db.getContact(txn, c));
|
storeMessage(txn, g.getId(), dev, e.getKey(), e.getValue(), 0,
|
||||||
for (Entry<TransportId, TransportProperties> e : props.entrySet()) {
|
false, false);
|
||||||
storeMessage(txn, g.getId(), dev, e.getKey(), e.getValue(), 0,
|
|
||||||
false, false);
|
|
||||||
}
|
|
||||||
txn.setComplete();
|
|
||||||
} finally {
|
|
||||||
db.endTransaction(txn);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user