mirror of
https://github.com/2dust/v2rayN.git
synced 2026-01-06 02:29:56 +05:00
Improve latency testing
This commit is contained in:
@@ -294,12 +294,16 @@ namespace v2rayN.Handler
|
|||||||
UseProxy = webProxy != null
|
UseProxy = webProxy != null
|
||||||
});
|
});
|
||||||
|
|
||||||
var timer = Stopwatch.StartNew();
|
List<int> oneTime = [];
|
||||||
|
for (int i = 0; i < 2; i++)
|
||||||
await client.GetAsync(url, cts.Token);
|
{
|
||||||
|
var timer = Stopwatch.StartNew();
|
||||||
timer.Stop();
|
await client.GetAsync(url, cts.Token);
|
||||||
responseTime = (int)timer.Elapsed.TotalMilliseconds;
|
timer.Stop();
|
||||||
|
oneTime.Add((int)timer.Elapsed.TotalMilliseconds);
|
||||||
|
await Task.Delay(100);
|
||||||
|
}
|
||||||
|
responseTime = oneTime.Where(x => x > 0).OrderBy(x => x).FirstOrDefault();
|
||||||
}
|
}
|
||||||
catch //(Exception ex)
|
catch //(Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user