mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2024-09-29 16:30:49 +00:00
Merge pull request #753 from greenart7c3/proxy_fix
Recreate http client when changing the proxy or timeout
This commit is contained in:
commit
504e55a93f
@ -51,6 +51,8 @@ object HttpClient {
|
|||||||
|
|
||||||
fun start(proxy: Proxy?) {
|
fun start(proxy: Proxy?) {
|
||||||
if (internalProxy != proxy) {
|
if (internalProxy != proxy) {
|
||||||
|
Log.d("HttpClient", "Changing proxy to: ${proxy != null}")
|
||||||
|
this.defaultHttpClient = null
|
||||||
this.internalProxy = proxy
|
this.internalProxy = proxy
|
||||||
this.defaultHttpClient = getHttpClient()
|
this.defaultHttpClient = getHttpClient()
|
||||||
}
|
}
|
||||||
@ -59,6 +61,7 @@ object HttpClient {
|
|||||||
fun changeTimeouts(timeout: Duration) {
|
fun changeTimeouts(timeout: Duration) {
|
||||||
Log.d("HttpClient", "Changing timeout to: $timeout")
|
Log.d("HttpClient", "Changing timeout to: $timeout")
|
||||||
if (this.defaultTimeout.seconds != timeout.seconds) {
|
if (this.defaultTimeout.seconds != timeout.seconds) {
|
||||||
|
this.defaultHttpClient = null
|
||||||
this.defaultTimeout = timeout
|
this.defaultTimeout = timeout
|
||||||
this.defaultHttpClient = getHttpClient()
|
this.defaultHttpClient = getHttpClient()
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ class Relay(
|
|||||||
private var connectingBlock = AtomicBoolean()
|
private var connectingBlock = AtomicBoolean()
|
||||||
|
|
||||||
fun connectAndRun(onConnected: (Relay) -> Unit) {
|
fun connectAndRun(onConnected: (Relay) -> Unit) {
|
||||||
Log.d("Relay", "Relay.connect $url")
|
Log.d("Relay", "Relay.connect $url hasProxy: ${this.httpClient.proxy != null}")
|
||||||
// BRB is crashing OkHttp Deflater object :(
|
// BRB is crashing OkHttp Deflater object :(
|
||||||
if (url.contains("brb.io")) return
|
if (url.contains("brb.io")) return
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user