Fixed pubkey retrieval

Broadcast subscriptions shouldn't be disabled every time a pubkey, message or broadcast comes along... (this might also fix other strange behaviour)
This commit is contained in:
Christian Basler 2017-05-19 19:49:35 +02:00
parent 239c6ec7f4
commit 869d2e0386

View File

@ -104,7 +104,7 @@ class DefaultMessageListener implements NetworkHandler.MessageListener, Internal
} else { } else {
address = ctx.getAddressRepository().findContact(pubkey.getRipe()); address = ctx.getAddressRepository().findContact(pubkey.getRipe());
} }
if (address != null) { if (address != null && address.getPubkey() == null) {
updatePubkey(address, pubkey); updatePubkey(address, pubkey);
} }
} catch (DecryptionFailedException ignore) { } catch (DecryptionFailedException ignore) {
@ -170,11 +170,15 @@ class DefaultMessageListener implements NetworkHandler.MessageListener, Internal
} }
protected void receive(InventoryVector iv, Plaintext msg) { protected void receive(InventoryVector iv, Plaintext msg) {
BitmessageAddress contact = ctx.getAddressRepository().getAddress(msg.getFrom().getAddress());
if (contact != null && contact.getPubkey() == null) {
updatePubkey(contact, msg.getFrom().getPubkey());
}
msg.setInventoryVector(iv); msg.setInventoryVector(iv);
labeler.setLabels(msg); labeler.setLabels(msg);
ctx.getMessageRepository().save(msg); ctx.getMessageRepository().save(msg);
listener.receive(msg); listener.receive(msg);
updatePubkey(msg.getFrom(), msg.getFrom().getPubkey());
if (msg.getType() == Plaintext.Type.MSG && msg.getTo().has(Pubkey.Feature.DOES_ACK)) { if (msg.getType() == Plaintext.Type.MSG && msg.getTo().has(Pubkey.Feature.DOES_ACK)) {
ObjectMessage ack = msg.getAckMessage(); ObjectMessage ack = msg.getAckMessage();