mirror of https://github.com/2dust/v2rayN
tcping增加5s超时机制; ping间隔降低至10ms
parent
6206c81546
commit
1b0e3b3575
|
@ -977,9 +977,9 @@ namespace v2rayN.Forms
|
|||
}
|
||||
private void ClearTestResult()
|
||||
{
|
||||
for (int k = 0; k < lvSelecteds.Count; k++)
|
||||
foreach (int s in lvSelecteds)
|
||||
{
|
||||
SetTestResult(lvSelecteds[k], "");
|
||||
SetTestResult(s, "");
|
||||
}
|
||||
}
|
||||
private void UpdateSpeedtestHandler(int index, string msg)
|
||||
|
|
|
@ -103,9 +103,8 @@ namespace v2rayN.Handler
|
|||
{
|
||||
try
|
||||
{
|
||||
for (int k = 0; k < _selecteds.Count; k++)
|
||||
foreach (int index in _selecteds)
|
||||
{
|
||||
int index = _selecteds[k];
|
||||
if (_config.vmess[index].configType == (int)EConfigType.Custom)
|
||||
{
|
||||
continue;
|
||||
|
@ -121,7 +120,7 @@ namespace v2rayN.Handler
|
|||
}
|
||||
}
|
||||
|
||||
Thread.Sleep(100);
|
||||
Thread.Sleep(10);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -262,8 +261,14 @@ namespace v2rayN.Handler
|
|||
var timer = new Stopwatch();
|
||||
timer.Start();
|
||||
|
||||
Socket clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
clientSocket.Connect(new IPEndPoint(ipAddress, port));
|
||||
var endPoint = new IPEndPoint(ipAddress, port);
|
||||
Socket clientSocket = new Socket(endPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
|
||||
|
||||
IAsyncResult result = clientSocket.BeginConnect(endPoint, null, null);
|
||||
if (!result.AsyncWaitHandle.WaitOne(TimeSpan.FromSeconds(5)))
|
||||
throw new TimeoutException("connect timeout (5s): " + url);
|
||||
clientSocket.EndConnect(result);
|
||||
|
||||
timer.Stop();
|
||||
responseTime = timer.Elapsed.Milliseconds;
|
||||
clientSocket.Close();
|
||||
|
|
Loading…
Reference in New Issue