mirror of https://github.com/2dust/v2rayN
Update subscription timeout is set to 30 seconds
parent
2a11fe11e8
commit
bcda8bd602
|
@ -56,7 +56,7 @@ namespace v2rayN.Base
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
public async Task<string> GetAsync(HttpClient client, string url)
|
public async Task<string> GetAsync(HttpClient client, string url, CancellationToken token)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(url))
|
if (string.IsNullOrEmpty(url))
|
||||||
{
|
{
|
||||||
|
@ -64,10 +64,7 @@ namespace v2rayN.Base
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var cts = new CancellationTokenSource();
|
HttpResponseMessage response = await client.GetAsync(url, token);
|
||||||
cts.CancelAfter(5000);
|
|
||||||
|
|
||||||
HttpResponseMessage response = await client.GetAsync(url, cts.Token);
|
|
||||||
return await response.Content.ReadAsStringAsync();
|
return await response.Content.ReadAsStringAsync();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
|
@ -156,7 +156,11 @@ namespace v2rayN.Handler
|
||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Utils.Base64Encode(uri.UserInfo));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Utils.Base64Encode(uri.UserInfo));
|
||||||
}
|
}
|
||||||
var result = await HttpClientHelper.GetInstance().GetAsync(client, url);
|
|
||||||
|
var cts = new CancellationTokenSource();
|
||||||
|
cts.CancelAfter(1000 * 30);
|
||||||
|
|
||||||
|
var result = await HttpClientHelper.GetInstance().GetAsync(client, url, cts.Token);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
Loading…
Reference in New Issue