From cfe8fcd28d1e671734d60072c4c99b876e18ed56 Mon Sep 17 00:00:00 2001
From: 2dust <31833384+2dust@users.noreply.github.com>
Date: Fri, 12 Jul 2024 14:23:29 +0800
Subject: [PATCH] up 6.51
---
v2rayN/v2rayN/Handler/DownloadHandle.cs | 6 ++++--
v2rayN/v2rayN/Handler/SpeedtestHandler.cs | 5 ++---
v2rayN/v2rayN/v2rayN.csproj | 4 ++--
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/v2rayN/v2rayN/Handler/DownloadHandle.cs b/v2rayN/v2rayN/Handler/DownloadHandle.cs
index b2e004db..51dca5ef 100644
--- a/v2rayN/v2rayN/Handler/DownloadHandle.cs
+++ b/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)
diff --git a/v2rayN/v2rayN/Handler/SpeedtestHandler.cs b/v2rayN/v2rayN/Handler/SpeedtestHandler.cs
index c399c7f2..14fc635a 100644
--- a/v2rayN/v2rayN/Handler/SpeedtestHandler.cs
+++ b/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);
diff --git a/v2rayN/v2rayN/v2rayN.csproj b/v2rayN/v2rayN/v2rayN.csproj
index 78890a20..675f7c80 100644
--- a/v2rayN/v2rayN/v2rayN.csproj
+++ b/v2rayN/v2rayN/v2rayN.csproj
@@ -10,14 +10,14 @@
enable
v2rayN.ico
Copyright © 2017-2024 (GPLv3)
- 6.50
+ 6.51
7.0
-
+