diff --git a/api/net/sf/briar/api/transport/ConnectionContext.java b/api/net/sf/briar/api/transport/ConnectionContext.java index 692d69b65c16fb362641b33bc4a5d228406ebe01..314392dc81ac04bb941b07928b22368b30151e8f 100644 --- a/api/net/sf/briar/api/transport/ConnectionContext.java +++ b/api/net/sf/briar/api/transport/ConnectionContext.java @@ -1,15 +1,12 @@ package net.sf.briar.api.transport; import net.sf.briar.api.ContactId; -import net.sf.briar.api.protocol.TransportId; import net.sf.briar.api.protocol.TransportIndex; public interface ConnectionContext { ContactId getContactId(); - TransportId getTransportId(); - TransportIndex getTransportIndex(); long getConnectionNumber(); diff --git a/components/net/sf/briar/transport/ConnectionContextImpl.java b/components/net/sf/briar/transport/ConnectionContextImpl.java index eedbf73fe6063dff6790fe228d30209458878e22..eb52114e3c6155b27a415f14cb77c09336e687ef 100644 --- a/components/net/sf/briar/transport/ConnectionContextImpl.java +++ b/components/net/sf/briar/transport/ConnectionContextImpl.java @@ -1,21 +1,18 @@ package net.sf.briar.transport; import net.sf.briar.api.ContactId; -import net.sf.briar.api.protocol.TransportId; import net.sf.briar.api.protocol.TransportIndex; import net.sf.briar.api.transport.ConnectionContext; class ConnectionContextImpl implements ConnectionContext { private final ContactId contactId; - private final TransportId transportId; private final TransportIndex transportIndex; private final long connectionNumber; - ConnectionContextImpl(ContactId contactId, TransportId transportId, - TransportIndex transportIndex, long connectionNumber) { + ConnectionContextImpl(ContactId contactId, TransportIndex transportIndex, + long connectionNumber) { this.contactId = contactId; - this.transportId = transportId; this.transportIndex = transportIndex; this.connectionNumber = connectionNumber; } @@ -24,10 +21,6 @@ class ConnectionContextImpl implements ConnectionContext { return contactId; } - public TransportId getTransportId() { - return transportId; - } - public TransportIndex getTransportIndex() { return transportIndex; } diff --git a/components/net/sf/briar/transport/ConnectionDispatcherImpl.java b/components/net/sf/briar/transport/ConnectionDispatcherImpl.java index ca25c792a6145470ce541d7c3a76c7e8ba160473..3cb09d0e4c22fbceb03dcd8e6482132b0bc210c4 100644 --- a/components/net/sf/briar/transport/ConnectionDispatcherImpl.java +++ b/components/net/sf/briar/transport/ConnectionDispatcherImpl.java @@ -62,12 +62,6 @@ public class ConnectionDispatcherImpl implements ConnectionDispatcher { r.dispose(false); return; } - if(!t.equals(ctx.getTransportId())) { - if(LOG.isLoggable(Level.WARNING)) - LOG.warning("Connection has unexpected transport ID"); - r.dispose(false); - return; - } batchConnFactory.createIncomingConnection(ctx.getTransportIndex(), ctx.getContactId(), r, encryptedIv); } @@ -112,12 +106,6 @@ public class ConnectionDispatcherImpl implements ConnectionDispatcher { s.dispose(false); return; } - if(!t.equals(ctx.getTransportId())) { - if(LOG.isLoggable(Level.WARNING)) - LOG.warning("Connection has unexpected transport ID"); - s.dispose(false); - return; - } streamConnFactory.createIncomingConnection(ctx.getTransportIndex(), ctx.getContactId(), s, encryptedIv); } diff --git a/components/net/sf/briar/transport/ConnectionRecogniserImpl.java b/components/net/sf/briar/transport/ConnectionRecogniserImpl.java index 6c139c6346438990f2c469e8d1295e9583e79c11..a8745f61e4b94ed93b32184fd9ad7eccb9e66c50 100644 --- a/components/net/sf/briar/transport/ConnectionRecogniserImpl.java +++ b/components/net/sf/briar/transport/ConnectionRecogniserImpl.java @@ -82,17 +82,17 @@ DatabaseListener { TransportIndex i = db.getRemoteIndex(c, t); if(i != null) { ConnectionWindow w = db.getConnectionWindow(c, i); - calculateIvs(c, t, i, ivKey, w); + calculateIvs(c, i, ivKey, w); } } } - private synchronized void calculateIvs(ContactId c, TransportId t, - TransportIndex i, ErasableKey ivKey, ConnectionWindow w) + private synchronized void calculateIvs(ContactId c, TransportIndex i, + ErasableKey ivKey, ConnectionWindow w) throws DbException { for(Long unseen : w.getUnseen()) { Bytes iv = new Bytes(encryptIv(i, unseen, ivKey)); - expected.put(iv, new ConnectionContextImpl(c, t, i, unseen)); + expected.put(iv, new ConnectionContextImpl(c, i, unseen)); } } @@ -136,7 +136,7 @@ DatabaseListener { byte[] secret = db.getSharedSecret(c, true); ErasableKey ivKey = crypto.deriveIvKey(secret, true); for(int j = 0; j < secret.length; j++) secret[j] = 0; - calculateIvs(c, ctx.getTransportId(), i, ivKey, w); + calculateIvs(c, i, ivKey, w); } catch(NoSuchContactException e) { // The contact was removed - clean up when we get the event } @@ -191,7 +191,7 @@ DatabaseListener { TransportIndex i = db.getRemoteIndex(c, t); if(i != null) { ConnectionWindow w = db.getConnectionWindow(c, i); - calculateIvs(c, t, i, ivKey, w); + calculateIvs(c, i, ivKey, w); } } catch(NoSuchContactException e) { // The contact was removed - clean up when we get the event diff --git a/test/net/sf/briar/transport/ConnectionRecogniserImplTest.java b/test/net/sf/briar/transport/ConnectionRecogniserImplTest.java index d9cf7b8db5552352951999e15ba48a89417b5273..04715419666a07b71b78176b18301f9a0dafaf46 100644 --- a/test/net/sf/briar/transport/ConnectionRecogniserImplTest.java +++ b/test/net/sf/briar/transport/ConnectionRecogniserImplTest.java @@ -116,7 +116,6 @@ public class ConnectionRecogniserImplTest extends TestCase { ConnectionContext ctx = c.acceptConnection(encryptedIv); assertNotNull(ctx); assertEquals(contactId, ctx.getContactId()); - assertEquals(transportId, ctx.getTransportId()); assertEquals(remoteIndex, ctx.getTransportIndex()); assertEquals(3L, ctx.getConnectionNumber()); // Second time - the IV should no longer be expected diff --git a/test/net/sf/briar/transport/batch/BatchConnectionReadWriteTest.java b/test/net/sf/briar/transport/batch/BatchConnectionReadWriteTest.java index 06d4e7fc6fb3b4009b07fd8436589198e29806c4..592a46c4873a22a17cd91dc45e81d1a679ac8331 100644 --- a/test/net/sf/briar/transport/batch/BatchConnectionReadWriteTest.java +++ b/test/net/sf/briar/transport/batch/BatchConnectionReadWriteTest.java @@ -162,7 +162,6 @@ public class BatchConnectionReadWriteTest extends TestCase { ConnectionContext ctx = rec.acceptConnection(encryptedIv); assertNotNull(ctx); assertEquals(contactId, ctx.getContactId()); - assertEquals(transportId, ctx.getTransportId()); assertEquals(transportIndex, ctx.getTransportIndex()); // Create an incoming batch connection ConnectionReaderFactory connFactory =