Merge branch 'inactive-contacts' into 'master'

Don't connect to inactive contacts

Two changes:

1. Don't use remote transport properties for contacts that are in the process of being introduced - this avoids wasted connection attempts, as we can't create stream contexts for such contacts.

2. Don't activate contacts when receiving incoming streams - doing so was meant as a workaround for newly introduced contacts having inconsistent views of their introduction status if the introducer was offline. But it just shifted the inconsistency elsewhee, so this change removes the workaround.


See merge request !153
This commit is contained in:
akwizgran
2016-04-25 15:22:51 +00:00
2 changed files with 2 additions and 3 deletions

View File

@@ -164,6 +164,8 @@ class TransportPropertyManagerImpl implements TransportPropertyManager,
Transaction txn = db.startTransaction(true);
try {
for (Contact c : db.getContacts(txn)) {
// Don't return properties for inactive contacts
if (!c.isActive()) continue;
Group g = getContactGroup(c);
// Find the latest remote update
LatestUpdate latest = findLatest(txn, g.getId(), t, false);

View File

@@ -134,9 +134,6 @@ class KeyManagerImpl implements KeyManager, Service, EventListener {
Transaction txn = db.startTransaction(false);
try {
ctx = m.getStreamContext(txn, tag);
// Activate the contact if not already active
if (ctx != null && !activeContacts.containsKey(ctx.getContactId()))
db.setContactActive(txn, ctx.getContactId(), true);
txn.setComplete();
} finally {
db.endTransaction(txn);