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;
|
||||
}
|
||||
public async Task<string> GetAsync(HttpClient client, string url)
|
||||
public async Task<string> GetAsync(HttpClient client, string url, CancellationToken token)
|
||||
{
|
||||
if (string.IsNullOrEmpty(url))
|
||||
{
|
||||
|
@ -64,10 +64,7 @@ namespace v2rayN.Base
|
|||
}
|
||||
try
|
||||
{
|
||||
var cts = new CancellationTokenSource();
|
||||
cts.CancelAfter(5000);
|
||||
|
||||
HttpResponseMessage response = await client.GetAsync(url, cts.Token);
|
||||
HttpResponseMessage response = await client.GetAsync(url, token);
|
||||
return await response.Content.ReadAsStringAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
|
@ -156,7 +156,11 @@ namespace v2rayN.Handler
|
|||
{
|
||||
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;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
Loading…
Reference in New Issue