File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
android/app/src/main/kotlin/com/invertedx/sentinelx/api Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,9 @@ import io.reactivex.Observable
1010import okhttp3.FormBody
1111import okhttp3.OkHttpClient
1212import okhttp3.Request
13+ import java.time.Duration
14+ import java.time.temporal.TemporalUnit
15+ import java.util.concurrent.TimeUnit
1316import javax.net.ssl.SSLContext
1417import javax.net.ssl.TrustManager
1518import javax.net.ssl.X509TrustManager
@@ -128,7 +131,6 @@ class ApiService(private val applicationContext: Context) {
128131 .url(baseUrl)
129132 .method(" POST" , requestBody)
130133 .build()
131-
132134 val response = client.newCall(request).execute()
133135 val content = response.body()!! .string()
134136 Log .i(" API" , " response -> $content " )
@@ -147,6 +149,8 @@ class ApiService(private val applicationContext: Context) {
147149 getHostNameVerifier(builder)
148150 builder.proxy(TorManager .getInstance(this .applicationContext).proxy)
149151 }
152+ builder.connectTimeout(60 , TimeUnit .SECONDS ) // connect timeout
153+ builder.readTimeout(60 , TimeUnit .SECONDS )
150154 client = builder.build()
151155 }
152156
You can’t perform that action at this time.
0 commit comments