/** * Checks the DHT for all undelivered packets belonging to a given email. * @param email * @throws InterruptedException */ private void checkDelivery(Email email) throws InterruptedException { EmailMetadata metadata = email.getMetadata(); Collection<PacketInfo> packets = metadata.getUndeliveredPacketKeys(); synchronized(sentFolder) { boolean updateMetadata = false; for (PacketInfo packet: packets) { UniqueId delAuth = dht.findDeleteAuthorizationKey(packet.dhtKey, packet.delVerificationHash); if (delAuth != null) { metadata.setPacketDelivered(packet.dhtKey, true); updateMetadata = true; log.debug("Delivery of email packet with DHT key " + packet.dhtKey + " confirmed."); } } if (updateMetadata) try { sentFolder.saveMetadata(email); } catch (Exception e) { log.error("Can't save email metadata.", e); } } } }