mirror of https://github.com/2dust/v2rayN
Improve latency testing
parent
1dd3ee4e0a
commit
08b1c8ec83
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue