Derive all OkHttp clients from one shared base client

The DoH transport keeps its own connection pool and no longer creates
the dispatcher's thread pool only to shut it down.
This commit is contained in:
2026-10-25 12:23:46 +02:00
parent 5f56c471ce
commit 5a1bf79e4b
4 changed files with 23 additions and 9 deletions
@@ -0,0 +1,14 @@
package cc.skysparkle.sparkledns
import okhttp3.OkHttpClient
import java.util.concurrent.TimeUnit
// Base for every OkHttp client in the app. Clients made with newBuilder() share its dispatcher
// and thread pools, and its connection pool unless they bring their own.
internal object Http {
val client: OkHttpClient by lazy {
OkHttpClient.Builder()
.connectTimeout(15, TimeUnit.SECONDS)
.build()
}
}