diff --git a/briar-android-tests/src/test/java/org/briarproject/introduction/IntroductionIntegrationTest.java b/briar-android-tests/src/test/java/org/briarproject/introduction/IntroductionIntegrationTest.java index d3745f08b00c7ad667cb7f1ce7a1a6f6544e3a0c..86ed51afb12f38f345522aa389ba7aa7970a846b 100644 --- a/briar-android-tests/src/test/java/org/briarproject/introduction/IntroductionIntegrationTest.java +++ b/briar-android-tests/src/test/java/org/briarproject/introduction/IntroductionIntegrationTest.java @@ -240,8 +240,8 @@ public class IntroductionIntegrationTest extends BriarIntegrationTest { // sync forwarded responses to introducees deliverMessage(sync0, contactId0, sync1, contactId1, "0 to 1"); deliverMessage(sync0, contactId0, sync2, contactId2, "0 to 2"); - assertGroupCount(messageTracker1, g1.getId(), 3, 2); - assertGroupCount(messageTracker2, g2.getId(), 3, 2); + assertGroupCount(messageTracker1, g1.getId(), 2, 1); + assertGroupCount(messageTracker2, g2.getId(), 2, 1); // sync first ACK and its forward deliverMessage(sync1, contactId1, sync0, contactId0, "1 to 0"); @@ -276,8 +276,8 @@ public class IntroductionIntegrationTest extends BriarIntegrationTest { assertDefaultUiMessages(); assertGroupCount(messageTracker0, g1.getId(), 2, 1); assertGroupCount(messageTracker0, g2.getId(), 2, 1); - assertGroupCount(messageTracker1, g1.getId(), 3, 2); - assertGroupCount(messageTracker2, g2.getId(), 3, 2); + assertGroupCount(messageTracker1, g1.getId(), 2, 1); + assertGroupCount(messageTracker2, g2.getId(), 2, 1); } finally { stopLifecycles(); } @@ -332,19 +332,27 @@ public class IntroductionIntegrationTest extends BriarIntegrationTest { assertFalse(contactManager2 .contactExists(author1.getId(), author2.getId())); + Group g1 = introductionGroupFactory + .createIntroductionGroup(introducee1); + Group g2 = introductionGroupFactory + .createIntroductionGroup(introducee2); assertEquals(2, introductionManager0.getIntroductionMessages(contactId1) .size()); + assertGroupCount(messageTracker0, g1.getId(), 2, 1); assertEquals(2, introductionManager0.getIntroductionMessages(contactId2) .size()); + assertGroupCount(messageTracker0, g2.getId(), 2, 1); assertEquals(2, introductionManager1.getIntroductionMessages(contactId0) .size()); + assertGroupCount(messageTracker1, g1.getId(), 2, 1); // introducee2 should also have the decline response of introducee1 assertEquals(3, introductionManager2.getIntroductionMessages(contactId0) .size()); + assertGroupCount(messageTracker2, g2.getId(), 3, 2); } finally { stopLifecycles(); } diff --git a/briar-core/src/org/briarproject/introduction/IntroductionManagerImpl.java b/briar-core/src/org/briarproject/introduction/IntroductionManagerImpl.java index e3f7981a5d16ed3485d6e12f1967e5d59e736dd3..8bdae86880a0ce323f33512499448d4130fd475f 100644 --- a/briar-core/src/org/briarproject/introduction/IntroductionManagerImpl.java +++ b/briar-core/src/org/briarproject/introduction/IntroductionManagerImpl.java @@ -237,15 +237,17 @@ class IntroductionManagerImpl extends ConversationClientImpl try { if (role == ROLE_INTRODUCER) { introducerManager.incomingMessage(txn, state, message); + if (type == TYPE_RESPONSE) + messageTracker.trackIncomingMessage(txn, m); } else if (role == ROLE_INTRODUCEE) { introduceeManager.incomingMessage(txn, state, message); + if (type == TYPE_RESPONSE && !message.getBoolean(ACCEPT)) + messageTracker.trackIncomingMessage(txn, m); } else { if (LOG.isLoggable(WARNING)) LOG.warning("Unknown role '" + role + "'"); throw new DbException(); } - if (type == TYPE_RESPONSE) - messageTracker.trackIncomingMessage(txn, m); } catch (DbException e) { if (LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e); if (role == ROLE_INTRODUCER) introducerManager.abort(txn, state);