mirror of
				https://github.com/recloudstream/cloudstream.git
				synced 2024-08-15 01:53:11 +00:00 
			
		
		
		
	Fixed random timeout crashes
This commit is contained in:
		
							parent
							
								
									d6aa0e576c
								
							
						
					
					
						commit
						2bd4d67c5d
					
				
					 3 changed files with 4 additions and 6 deletions
				
			
		|  | @ -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…
	
	Add table
		Add a link
		
	
		Reference in a new issue