Bug with checking contactId, improve logging

This commit is contained in:
ameba23
2021-09-30 15:54:32 +02:00
parent 274722d695
commit 41443db817
2 changed files with 5 additions and 3 deletions

View File

@@ -152,7 +152,7 @@ class IncomingDuplexSyncConnection extends DuplexSyncConnection
handshakeManager.handshake(contactId, in, out);
keyManager.addRotationKeys(contactId, result.getMasterKey(),
TIMESTAMP, result.isAlice(), true);
LOG.info("Rotation keys added");
LOG.info("Rotation keys added - IncomingDuplexSyncConnection");
return true;
} catch (IOException | DbException e) {
logException(LOG, WARNING, e);

View File

@@ -64,6 +64,7 @@ class OutgoingDuplexSyncConnection extends DuplexSyncConnection
LOG.info("Running OutgoingDuplexSyncConnection on transport " +
transportId.getString());
// Allocate a stream context
StreamContext ctx = allocateStreamContext(contactId, transportId);
if (ctx == null) {
LOG.warning("Could not allocate stream context");
@@ -71,6 +72,7 @@ class OutgoingDuplexSyncConnection extends DuplexSyncConnection
return;
}
if (ctx.isHandshakeMode()) {
LOG.info("OutgoingDuplexSyncConnection - context is in handshake mode, performing handshake");
if (!performHandshake(ctx)) {
LOG.warning("Handshake failed");
return;
@@ -178,7 +180,7 @@ class OutgoingDuplexSyncConnection extends DuplexSyncConnection
}
// Check that the stream comes from the expected contact
ContactId inContactId = ctxIn.getContactId();
if (contactId == null) {
if (inContactId == null) {
LOG.warning("Expected contact tag, got rendezvous tag");
onReadError();
return false;
@@ -197,7 +199,7 @@ class OutgoingDuplexSyncConnection extends DuplexSyncConnection
handshakeManager.handshake(contactId, in, out);
keyManager.addRotationKeys(contactId, result.getMasterKey(),
TIMESTAMP, result.isAlice(), true);
LOG.info("Rotation keys added");
LOG.info("Rotation keys added - OutgoingDuplexSyncConnection");
return true;
} catch (IOException | DbException e) {
logException(LOG, WARNING, e);