From 75e7fa584133e218965b27d5283ec3254f0b9ae1 Mon Sep 17 00:00:00 2001 From: bontric <benjohnwie@gmail.com> Date: Thu, 20 Sep 2018 18:25:45 +0200 Subject: [PATCH] remove contactId from TAKE request (contactId is identified by reading the tag from the encrypted stream) --- .../mailbox/protocol/MailboxRequestTake.java | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/bramble-core/src/main/java/org/briarproject/bramble/mailbox/protocol/MailboxRequestTake.java b/bramble-core/src/main/java/org/briarproject/bramble/mailbox/protocol/MailboxRequestTake.java index 6fe0b80ac..9919f0c85 100644 --- a/bramble-core/src/main/java/org/briarproject/bramble/mailbox/protocol/MailboxRequestTake.java +++ b/bramble-core/src/main/java/org/briarproject/bramble/mailbox/protocol/MailboxRequestTake.java @@ -5,12 +5,10 @@ import org.briarproject.bramble.api.contact.ContactId; import org.briarproject.bramble.api.data.BdfList; public class MailboxRequestTake extends MailboxRequest { - private ContactId contactId; private byte[] encryptedSyncStream = null; - public MailboxRequestTake(ContactId contactId, byte[] encryptedSyncStream) { + public MailboxRequestTake(byte[] encryptedSyncStream) { super(TYPE.TAKE); - this.contactId = contactId; this.encryptedSyncStream = encryptedSyncStream; } @@ -20,7 +18,7 @@ public class MailboxRequestTake extends MailboxRequest { @Override protected BdfList getRequestBody() { - return BdfList.of(contactId.getInt(), encryptedSyncStream); + return BdfList.of(encryptedSyncStream); } @Override @@ -30,20 +28,12 @@ public class MailboxRequestTake extends MailboxRequest { @Override public void parseBody(BdfList msg) throws FormatException { - Long cId = msg.getLong(0); - - if (cId > Integer.MAX_VALUE || cId < Integer.MIN_VALUE) - throw new FormatException(); - - this.contactId = new ContactId(cId.intValue()); - this.encryptedSyncStream = msg.getRaw(1); + this.encryptedSyncStream = msg.getRaw(0); } public byte[] getEncryptedSyncStream() { return encryptedSyncStream; } - public ContactId getContactId() { - return contactId; - } + } -- GitLab