forked from recloudstream/cloudstream
Fixed random timeout crashes
This commit is contained in:
parent
d6aa0e576c
commit
2bd4d67c5d
3 changed files with 4 additions and 6 deletions
|
@ -170,7 +170,7 @@ dependencies {
|
|||
// Networking
|
||||
// implementation "com.squareup.okhttp3:okhttp:4.9.2"
|
||||
// implementation "com.squareup.okhttp3:okhttp-dnsoverhttps:4.9.1"
|
||||
implementation 'com.github.Blatzar:NiceHttp:0.3.2'
|
||||
implementation 'com.github.Blatzar:NiceHttp:0.3.3'
|
||||
|
||||
// Util to skip the URI file fuckery 🙏
|
||||
implementation "com.github.tachiyomiorg:unifile:17bec43"
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.bumptech.glide.load.HttpException
|
|||
import com.lagradost.cloudstream3.BuildConfig
|
||||
import com.lagradost.cloudstream3.ErrorLoadingException
|
||||
import kotlinx.coroutines.*
|
||||
import java.io.InterruptedIOException
|
||||
import java.net.SocketTimeoutException
|
||||
import java.net.UnknownHostException
|
||||
import javax.net.ssl.SSLHandshakeException
|
||||
|
@ -157,7 +158,7 @@ suspend fun <T> safeApiCall(
|
|||
}
|
||||
safeFail(throwable)
|
||||
}
|
||||
is SocketTimeoutException -> {
|
||||
is SocketTimeoutException, is InterruptedIOException -> {
|
||||
Resource.Failure(
|
||||
true,
|
||||
null,
|
||||
|
@ -192,7 +193,7 @@ suspend fun <T> safeApiCall(
|
|||
true,
|
||||
null,
|
||||
null,
|
||||
(throwable.message ?: "SSLHandshakeException") + "\nTry again later."
|
||||
(throwable.message ?: "SSLHandshakeException") + "\nTry a VPN or DNS."
|
||||
)
|
||||
}
|
||||
else -> safeFail(throwable)
|
||||
|
|
|
@ -5,15 +5,12 @@ import androidx.preference.PreferenceManager
|
|||
import com.lagradost.cloudstream3.R
|
||||
import com.lagradost.cloudstream3.USER_AGENT
|
||||
import com.lagradost.nicehttp.Requests
|
||||
import com.lagradost.nicehttp.getCookies
|
||||
import com.lagradost.nicehttp.ignoreAllSSLErrors
|
||||
import okhttp3.Cache
|
||||
import okhttp3.Headers
|
||||
import okhttp3.Headers.Companion.toHeaders
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import java.io.File
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
|
||||
fun Requests.initClient(context: Context): OkHttpClient {
|
||||
|
|
Loading…
Reference in a new issue