Skip to content
Snippets Groups Projects
Verified Commit e3459fb0 authored by Torsten Grote's avatar Torsten Grote
Browse files

Use given transaction when adding remote properties in TransportPropertyManager.

parent 5bde14c6
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@ import org.briarproject.api.DeviceId;
import org.briarproject.api.TransportId;
import org.briarproject.api.contact.ContactId;
import org.briarproject.api.db.DbException;
import org.briarproject.api.db.Transaction;
import java.util.Map;
......@@ -13,7 +14,7 @@ public interface TransportPropertyManager {
* Stores the given properties received while adding a contact - they will
* 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;
/** Returns the local transport properties for all transports. */
......
......@@ -82,18 +82,12 @@ class TransportPropertyManagerImpl implements TransportPropertyManager,
}
@Override
public void addRemoteProperties(ContactId c, DeviceId dev,
public void addRemoteProperties(Transaction txn, ContactId c, DeviceId dev,
Map<TransportId, TransportProperties> props) throws DbException {
Transaction txn = db.startTransaction(false);
try {
Group g = getContactGroup(db.getContact(txn, c));
for (Entry<TransportId, TransportProperties> e : props.entrySet()) {
storeMessage(txn, g.getId(), dev, e.getKey(), e.getValue(), 0,
false, false);
}
txn.setComplete();
} finally {
db.endTransaction(txn);
Group g = getContactGroup(db.getContact(txn, c));
for (Entry<TransportId, TransportProperties> e : props.entrySet()) {
storeMessage(txn, g.getId(), dev, e.getKey(), e.getValue(), 0,
false, false);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment