diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/Amethyst.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/Amethyst.kt index 9101a08fb..fe960b6d1 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/Amethyst.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/Amethyst.kt @@ -82,7 +82,7 @@ class Amethyst : Application() { // Service that will run at all times to receive events from Pokey val pokeyReceiver = PokeyReceiver() - // creates okHttpClients based on the conditions of the connection and tor status + // manages all the other connections separately from relays. val okHttpClients = DualHttpClientManager( userAgent = appAgent, @@ -92,12 +92,22 @@ class Amethyst : Application() { scope = applicationIOScope, ) + // manages all relay connections + val okHttpClientForRelays = + DualHttpClientManager( + userAgent = appAgent, + proxyPortProvider = torManager.activePortOrNull, + isMobileDataProvider = connManager.isMobileOrNull, + keyCache = keyCache, + scope = applicationIOScope, + ) + val torProxySettingsAnchor = ProxySettingsAnchor() // Connects the NostrClient class with okHttp val websocketBuilder = OkHttpWebSocket.Builder { url -> - okHttpClients.getHttpClient(torProxySettingsAnchor.useProxy(url)) + okHttpClientForRelays.getHttpClient(torProxySettingsAnchor.useProxy(url)) } // Caches all events in Memory