From a0c88da1ac79bc736c3a74e56469945bfd2f1895 Mon Sep 17 00:00:00 2001 From: akwizgran <michael@briarproject.org> Date: Wed, 14 Mar 2018 11:25:24 +0000 Subject: [PATCH] Report UNKNOWN state for cross-group dependencies. This causes the validator to treat the dependent message in the same way regardless of whether there is a subscription to the dependency's group. --- .../main/java/org/briarproject/bramble/db/JdbcDatabase.java | 3 +-- .../java/org/briarproject/bramble/db/JdbcDatabaseTest.java | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/bramble-core/src/main/java/org/briarproject/bramble/db/JdbcDatabase.java b/bramble-core/src/main/java/org/briarproject/bramble/db/JdbcDatabase.java index 02f2876b0e..ed9bc88f22 100644 --- a/bramble-core/src/main/java/org/briarproject/bramble/db/JdbcDatabase.java +++ b/bramble-core/src/main/java/org/briarproject/bramble/db/JdbcDatabase.java @@ -57,7 +57,6 @@ import static org.briarproject.bramble.api.sync.Group.Visibility.INVISIBLE; import static org.briarproject.bramble.api.sync.Group.Visibility.SHARED; import static org.briarproject.bramble.api.sync.Group.Visibility.VISIBLE; import static org.briarproject.bramble.api.sync.ValidationManager.State.DELIVERED; -import static org.briarproject.bramble.api.sync.ValidationManager.State.INVALID; import static org.briarproject.bramble.api.sync.ValidationManager.State.PENDING; import static org.briarproject.bramble.api.sync.ValidationManager.State.UNKNOWN; import static org.briarproject.bramble.db.DatabaseConstants.DB_SETTINGS_NAMESPACE; @@ -1681,7 +1680,7 @@ abstract class JdbcDatabase implements Database<Connection> { GroupId dependentGroupId = new GroupId(rs.getBytes(3)); GroupId dependencyGroupId = new GroupId(rs.getBytes(4)); if (!dependentGroupId.equals(dependencyGroupId)) - state = INVALID; // Dependency in another group + state = UNKNOWN; // Dependency in another group } dependencies.put(dependency, state); } diff --git a/bramble-core/src/test/java/org/briarproject/bramble/db/JdbcDatabaseTest.java b/bramble-core/src/test/java/org/briarproject/bramble/db/JdbcDatabaseTest.java index c21d5b26a4..04244a3105 100644 --- a/bramble-core/src/test/java/org/briarproject/bramble/db/JdbcDatabaseTest.java +++ b/bramble-core/src/test/java/org/briarproject/bramble/db/JdbcDatabaseTest.java @@ -1332,8 +1332,8 @@ public abstract class JdbcDatabaseTest extends BrambleTestCase { Map<MessageId, State> dependencies; dependencies = db.getMessageDependencies(txn, messageId); - // The cross-group dependency should have state INVALID - assertEquals(INVALID, dependencies.get(messageId1)); + // The cross-group dependency should have state UNKNOWN + assertEquals(UNKNOWN, dependencies.get(messageId1)); // The missing dependency should have state UNKNOWN assertEquals(UNKNOWN, dependencies.get(messageId2)); -- GitLab