mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-20 22:59:54 +01:00
Add some logging to connectivity checks.
This commit is contained in:
@@ -5,13 +5,20 @@ import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
|||||||
import org.briarproject.bramble.api.system.Clock;
|
import org.briarproject.bramble.api.system.Clock;
|
||||||
import org.briarproject.bramble.mailbox.MailboxApi.ApiException;
|
import org.briarproject.bramble.mailbox.MailboxApi.ApiException;
|
||||||
|
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import javax.annotation.concurrent.ThreadSafe;
|
import javax.annotation.concurrent.ThreadSafe;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import static java.util.logging.Logger.getLogger;
|
||||||
|
|
||||||
@ThreadSafe
|
@ThreadSafe
|
||||||
@NotNullByDefault
|
@NotNullByDefault
|
||||||
class ContactMailboxConnectivityChecker extends ConnectivityCheckerImpl {
|
class ContactMailboxConnectivityChecker extends ConnectivityCheckerImpl {
|
||||||
|
|
||||||
|
private static final Logger LOG =
|
||||||
|
getLogger(ContactMailboxConnectivityChecker.class.getName());
|
||||||
|
|
||||||
private final MailboxApi mailboxApi;
|
private final MailboxApi mailboxApi;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@@ -25,7 +32,9 @@ class ContactMailboxConnectivityChecker extends ConnectivityCheckerImpl {
|
|||||||
ApiCall createConnectivityCheckTask(MailboxProperties properties) {
|
ApiCall createConnectivityCheckTask(MailboxProperties properties) {
|
||||||
if (properties.isOwner()) throw new IllegalArgumentException();
|
if (properties.isOwner()) throw new IllegalArgumentException();
|
||||||
return new SimpleApiCall(() -> {
|
return new SimpleApiCall(() -> {
|
||||||
|
LOG.info("Checking connectivity of contact's mailbox");
|
||||||
if (!mailboxApi.checkStatus(properties)) throw new ApiException();
|
if (!mailboxApi.checkStatus(properties)) throw new ApiException();
|
||||||
|
LOG.info("Contact's mailbox is reachable");
|
||||||
// Call the observers and cache the result
|
// Call the observers and cache the result
|
||||||
onConnectivityCheckSucceeded(clock.currentTimeMillis());
|
onConnectivityCheckSucceeded(clock.currentTimeMillis());
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ class OwnMailboxConnectivityChecker extends ConnectivityCheckerImpl {
|
|||||||
private boolean checkConnectivityAndStoreResult(
|
private boolean checkConnectivityAndStoreResult(
|
||||||
MailboxProperties properties) throws DbException {
|
MailboxProperties properties) throws DbException {
|
||||||
try {
|
try {
|
||||||
|
LOG.info("Checking whether own mailbox is reachable");
|
||||||
List<MailboxVersion> serverSupports =
|
List<MailboxVersion> serverSupports =
|
||||||
mailboxApi.getServerSupports(properties);
|
mailboxApi.getServerSupports(properties);
|
||||||
LOG.info("Own mailbox is reachable");
|
LOG.info("Own mailbox is reachable");
|
||||||
|
|||||||
Reference in New Issue
Block a user