mirror of
https://github.com/kalarina-bit/Sparkledns.git
synced 2026-11-22 07:36:09 +00:00
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:
@@ -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()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user