Browse Source

up 6.51

pull/5377/head 6.51
2dust 4 months ago
parent
commit
cfe8fcd28d
  1. 6
      v2rayN/v2rayN/Handler/DownloadHandle.cs
  2. 5
      v2rayN/v2rayN/Handler/SpeedtestHandler.cs
  3. 4
      v2rayN/v2rayN/v2rayN.csproj

6
v2rayN/v2rayN/Handler/DownloadHandle.cs

@ -286,8 +286,6 @@ namespace v2rayN.Handler
int responseTime = -1;
try
{
Stopwatch timer = Stopwatch.StartNew();
using var cts = new CancellationTokenSource();
cts.CancelAfter(TimeSpan.FromSeconds(downloadTimeout));
using var client = new HttpClient(new SocketsHttpHandler()
@ -295,8 +293,12 @@ namespace v2rayN.Handler
Proxy = webProxy,
UseProxy = webProxy != null
});
var timer = Stopwatch.StartNew();
await client.GetAsync(url, cts.Token);
timer.Stop();
responseTime = (int)timer.Elapsed.TotalMilliseconds;
}
catch //(Exception ex)

5
v2rayN/v2rayN/Handler/SpeedtestHandler.cs

@ -377,13 +377,12 @@ namespace v2rayN.Handler
ipAddress = ipHostInfo.AddressList[0];
}
Stopwatch timer = new();
timer.Start();
var timer = Stopwatch.StartNew();
IPEndPoint endPoint = new(ipAddress, port);
using Socket clientSocket = new(endPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
IAsyncResult result = clientSocket.BeginConnect(endPoint, null, null);
var result = clientSocket.BeginConnect(endPoint, null, null);
if (!result.AsyncWaitHandle.WaitOne(TimeSpan.FromSeconds(5)))
throw new TimeoutException("connect timeout (5s): " + url);
clientSocket.EndConnect(result);

4
v2rayN/v2rayN/v2rayN.csproj

@ -10,14 +10,14 @@
<ImplicitUsings>enable</ImplicitUsings>
<ApplicationIcon>v2rayN.ico</ApplicationIcon>
<Copyright>Copyright © 2017-2024 (GPLv3)</Copyright>
<FileVersion>6.50</FileVersion>
<FileVersion>6.51</FileVersion>
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Downloader" Version="3.1.2" />
<PackageReference Include="MaterialDesignThemes" Version="5.1.0" />
<PackageReference Include="H.NotifyIcon.Wpf" Version="2.0.131" />
<PackageReference Include="H.NotifyIcon.Wpf" Version="2.1.0" />
<PackageReference Include="QRCoder.Xaml" Version="1.6.0" />
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
<PackageReference Include="TaskScheduler" Version="2.11.0" />

Loading…
Cancel
Save