mirror of
https://github.com/2dust/v2rayNG.git
synced 2025-06-28 20:29:51 +00:00
The timeout was changed from 30s to 15s
This commit is contained in:
parent
0b9a96209f
commit
a60f45ce31
4 changed files with 9 additions and 9 deletions
|
@ -420,7 +420,7 @@ object AngConfigManager {
|
|||
|
||||
var configText = try {
|
||||
val httpPort = SettingsManager.getHttpPort()
|
||||
HttpUtil.getUrlContentWithUserAgent(url, 30000, httpPort)
|
||||
HttpUtil.getUrlContentWithUserAgent(url, 15000, httpPort)
|
||||
} catch (e: Exception) {
|
||||
Log.e(AppConfig.ANG_PACKAGE, "Update subscription: proxy not ready or other error, try……")
|
||||
//e.printStackTrace()
|
||||
|
|
|
@ -135,7 +135,7 @@ object SpeedtestManager {
|
|||
var result: String
|
||||
var elapsed = -1L
|
||||
|
||||
val conn = HttpUtil.createProxyConnection(SettingsManager.getDelayTestUrl(), port, 30000, 30000) ?: return Pair(elapsed, "")
|
||||
val conn = HttpUtil.createProxyConnection(SettingsManager.getDelayTestUrl(), port, 15000, 15000) ?: return Pair(elapsed, "")
|
||||
try {
|
||||
val start = SystemClock.elapsedRealtime()
|
||||
val code = conn.responseCode
|
||||
|
|
|
@ -206,9 +206,9 @@ class UserAssetActivity : BaseActivity() {
|
|||
var resultCount = 0
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
assets.forEach {
|
||||
var result = downloadGeo(it.second, 30000, httpPort)
|
||||
var result = downloadGeo(it.second, 15000, httpPort)
|
||||
if (!result) {
|
||||
result = downloadGeo(it.second, 30000, 0)
|
||||
result = downloadGeo(it.second, 15000, 0)
|
||||
}
|
||||
if (result)
|
||||
resultCount++
|
||||
|
|
|
@ -50,7 +50,7 @@ object HttpUtil {
|
|||
* @throws IOException If an I/O error occurs.
|
||||
*/
|
||||
@Throws(IOException::class)
|
||||
fun getUrlContentWithUserAgent(url: String?, timeout: Int = 30000, httpPort: Int = 0): String {
|
||||
fun getUrlContentWithUserAgent(url: String?, timeout: Int = 15000, httpPort: Int = 0): String {
|
||||
var currentUrl = url
|
||||
var redirects = 0
|
||||
val maxRedirects = 3
|
||||
|
@ -88,16 +88,16 @@ object HttpUtil {
|
|||
*
|
||||
* @param urlStr The target URL address.
|
||||
* @param port The port of the proxy server.
|
||||
* @param connectTimeout The connection timeout in milliseconds (default is 30000 ms).
|
||||
* @param readTimeout The read timeout in milliseconds (default is 30000 ms).
|
||||
* @param connectTimeout The connection timeout in milliseconds (default is 15000 ms).
|
||||
* @param readTimeout The read timeout in milliseconds (default is 15000 ms).
|
||||
* @param needStream Whether the connection needs to support streaming.
|
||||
* @return Returns a configured HttpURLConnection object, or null if it fails.
|
||||
*/
|
||||
fun createProxyConnection(
|
||||
urlStr: String,
|
||||
port: Int,
|
||||
connectTimeout: Int = 30000,
|
||||
readTimeout: Int = 30000,
|
||||
connectTimeout: Int = 15000,
|
||||
readTimeout: Int = 15000,
|
||||
needStream: Boolean = false
|
||||
): HttpURLConnection? {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue