Browse Source

Use HttpClient.Timeout for a 15-second timeout

tags/4.2.1.0
database64128 Student Main 4 years ago
parent
commit
43581630f0
No known key found for this signature in database GPG Key ID: AA78519C208C8742
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      shadowsocks-csharp/Controller/Service/OnlineConfigResolver.cs

+ 1
- 1
shadowsocks-csharp/Controller/Service/OnlineConfigResolver.cs View File

@@ -20,13 +20,13 @@ namespace Shadowsocks.Controller.Service
{
var httpClientHandler = new HttpClientHandler();
var httpClient = new HttpClient(httpClientHandler);
httpClient.Timeout = TimeSpan.FromSeconds(15);

if (proxy != null)
{
httpClientHandler.Proxy = proxy;
}

_ = Task.Delay(2000).ContinueWith(_ => httpClient.CancelPendingRequests());
string str = await httpClient.GetStringAsync(url);

var ret = Get(str);


Loading…
Cancel
Save