creates a separate okhttp for relays
This commit is contained in:
@@ -82,7 +82,7 @@ class Amethyst : Application() {
|
|||||||
// Service that will run at all times to receive events from Pokey
|
// Service that will run at all times to receive events from Pokey
|
||||||
val pokeyReceiver = PokeyReceiver()
|
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 =
|
val okHttpClients =
|
||||||
DualHttpClientManager(
|
DualHttpClientManager(
|
||||||
userAgent = appAgent,
|
userAgent = appAgent,
|
||||||
@@ -92,12 +92,22 @@ class Amethyst : Application() {
|
|||||||
scope = applicationIOScope,
|
scope = applicationIOScope,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// manages all relay connections
|
||||||
|
val okHttpClientForRelays =
|
||||||
|
DualHttpClientManager(
|
||||||
|
userAgent = appAgent,
|
||||||
|
proxyPortProvider = torManager.activePortOrNull,
|
||||||
|
isMobileDataProvider = connManager.isMobileOrNull,
|
||||||
|
keyCache = keyCache,
|
||||||
|
scope = applicationIOScope,
|
||||||
|
)
|
||||||
|
|
||||||
val torProxySettingsAnchor = ProxySettingsAnchor()
|
val torProxySettingsAnchor = ProxySettingsAnchor()
|
||||||
|
|
||||||
// Connects the NostrClient class with okHttp
|
// Connects the NostrClient class with okHttp
|
||||||
val websocketBuilder =
|
val websocketBuilder =
|
||||||
OkHttpWebSocket.Builder { url ->
|
OkHttpWebSocket.Builder { url ->
|
||||||
okHttpClients.getHttpClient(torProxySettingsAnchor.useProxy(url))
|
okHttpClientForRelays.getHttpClient(torProxySettingsAnchor.useProxy(url))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Caches all events in Memory
|
// Caches all events in Memory
|
||||||
|
|||||||
Reference in New Issue
Block a user