Skip to content
Snippets Groups Projects
Commit 78c43c9f authored by bontric's avatar bontric
Browse files

fix connection to contact mailboxes

parent a018e3d9
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -209,15 +209,11 @@ public class MailboxServiceImpl implements MailboxService, EventListener {
}
// Poll Contact mailboxes
Map<ContactId, TransportProperties> contacts;
Collection<MailboxInfo> contactMailboxes;
Transaction txn = null;
try {
txn = db.startTransaction(true);
contactMailboxes = db.getContactMailboxes(txn);
contacts =
transportPropertyManager.getRemotePropertiesByType(txn,
MailboxConstants.ID, ContactType.CONTACT);
db.commitTransaction(txn);
} catch (DbException e) {
logException(LOG, WARNING, e);
......@@ -240,28 +236,28 @@ public class MailboxServiceImpl implements MailboxService, EventListener {
continue;
}
TransportProperties properties =
contacts.get(mailboxInfo.getMailboxId());
if (properties == null)
throw new AssertionError();
ioExecutor.execute(
() -> connectContactMailbox(mailboxInfo.getContactId(),
properties));
ioExecutor.execute(() -> connectContactMailbox(mailboxInfo));
}
reschedule();
}
private void connectContactMailbox(ContactId contactId,
TransportProperties properties) {
private void connectContactMailbox(MailboxInfo mailboxInfo) {
for (TransportId transportId : transportOrder) {
if (!activePlugins.containsKey(transportId))
continue;
DuplexPlugin plugin = activePlugins.get(transportId);
TransportProperties properties;
try {
properties = transportPropertyManager
.getRemoteProperties(mailboxInfo.getMailboxId(), transportId);
} catch (DbException e) {
logException(LOG, WARNING, e);
return;
}
DuplexTransportConnection conn =
plugin.createConnection(properties);
......@@ -270,7 +266,7 @@ public class MailboxServiceImpl implements MailboxService, EventListener {
LOG.info("Contact mailbox connected");
mailboxManager.handleOutgoingContactMailboxConnection(
contactId, conn, transportId);
mailboxInfo.getContactId(), conn, transportId);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment