diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/server/WebServerManager.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/server/WebServerManager.kt index 335367f3a458d93bb0aec78acd685c1db9adb53b..ef517217d2f4312191026a33196a2b445797aacf 100644 --- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/server/WebServerManager.kt +++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/server/WebServerManager.kt @@ -16,7 +16,7 @@ import javax.inject.Singleton class WebServerManager @Inject constructor() : Service { internal companion object { - private const val PORT = 8888 + const val PORT = 8888 private val LOG = getLogger(WebServerManager::class.java) } diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/TorPlugin.java b/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/TorPlugin.java index 9f73da2e5f9c37927d75a873a763c889b4a34fdb..432e1b834548ebeb99d1c0de151c4fadb1146c1b 100644 --- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/TorPlugin.java +++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/tor/TorPlugin.java @@ -24,8 +24,10 @@ import net.freehaven.tor.control.EventHandler; import net.freehaven.tor.control.TorControlConnection; import org.briarproject.mailbox.core.PoliteExecutor; +import org.briarproject.mailbox.core.lifecycle.IoExecutor; import org.briarproject.mailbox.core.lifecycle.Service; import org.briarproject.mailbox.core.lifecycle.ServiceException; +import org.briarproject.mailbox.core.server.WebServerManager; import org.briarproject.mailbox.core.system.Clock; import org.briarproject.mailbox.core.system.LocationUtils; import org.briarproject.mailbox.core.system.ResourceProvider; @@ -215,7 +217,7 @@ abstract class TorPlugin implements Service, EventHandler { // Check whether we're online updateConnectionStatus(networkManager.getNetworkStatus()); // Create a hidden service if necessary - ioExecutor.execute(() -> publishHiddenService("8888")); + ioExecutor.execute(() -> publishHiddenService(String.valueOf(WebServerManager.PORT))); } private boolean assetsAreUpToDate() { @@ -313,6 +315,7 @@ abstract class TorPlugin implements Service, EventHandler { } } + @IoExecutor private void publishHiddenService(String port) { if (!state.isTorRunning()) return; // TODO get stored key @@ -320,6 +323,7 @@ abstract class TorPlugin implements Service, EventHandler { publishV3HiddenService(port, privKey3); } + @IoExecutor private void publishV3HiddenService(String port, @Nullable String privKey) { LOG.info("Creating v3 hidden service"); Map<Integer, String> portLines = singletonMap(80, "127.0.0.1:" + port); diff --git a/mailbox-core/src/main/java/org/briarproject/mailbox/core/util/LogUtils.kt b/mailbox-core/src/main/java/org/briarproject/mailbox/core/util/LogUtils.kt index 398094bb1282c2d214ac5a215df7a695e9bb981d..b209ee11343faf826b2855e565bd889943d84893 100644 --- a/mailbox-core/src/main/java/org/briarproject/mailbox/core/util/LogUtils.kt +++ b/mailbox-core/src/main/java/org/briarproject/mailbox/core/util/LogUtils.kt @@ -44,8 +44,8 @@ object LogUtils { * Logs the duration of a task. * * @param logger the logger to use - * @param task a description of the task - * @param start the start time of the task, as returned by [.now] + * @param msg a description of the task + * @param start the start time of the task, as returned by [now] */ @JvmStatic fun logDuration(logger: Logger, msg: () -> String, start: Long) {