mirror of https://github.com/2dust/v2rayN
speedtest
parent
b632dee0ce
commit
88c87aec0e
|
@ -1257,11 +1257,11 @@ namespace v2rayN.Forms
|
|||
{
|
||||
int httpPort = config.GetLocalPort(Global.InboundHttp);
|
||||
WebProxy webProxy = new WebProxy(Global.Loopback, httpPort);
|
||||
downloadHandle.DownloadFileAsync(url, webProxy, 60);
|
||||
downloadHandle.DownloadFileAsync(url, webProxy, 600);
|
||||
}
|
||||
else
|
||||
{
|
||||
downloadHandle.DownloadFileAsync(url, null, 60);
|
||||
downloadHandle.DownloadFileAsync(url, null, 600);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -228,19 +228,33 @@ namespace v2rayN.Handler
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ws_DownloadFileCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (UpdateCompleted != null)
|
||||
{
|
||||
if (e.Error != null) throw e.Error;
|
||||
if (e.Cancelled)
|
||||
{
|
||||
((WebClientEx)sender).Dispose();
|
||||
TimeSpan ts = (DateTime.Now - totalDatetime);
|
||||
string speed = string.Format("{0} M/s", (totalBytesToReceive / ts.TotalMilliseconds / 1000).ToString("#0.##"));
|
||||
UpdateCompleted(this, new ResultEventArgs(true, speed));
|
||||
return;
|
||||
}
|
||||
|
||||
((WebClientEx)sender).Dispose();
|
||||
TimeSpan ts = (DateTime.Now - totalDatetime);
|
||||
string speed = string.Format("<{0} MB/s", (totalBytesToReceive / ts.TotalMilliseconds / 1000).ToString("#0.##"));
|
||||
UpdateCompleted(this, new ResultEventArgs(true, speed));
|
||||
if (e.Error == null
|
||||
|| Utils.IsNullOrEmpty(e.Error.ToString()))
|
||||
{
|
||||
|
||||
TimeSpan ts = (DateTime.Now - totalDatetime);
|
||||
string speed = string.Format("{0} M/s", (totalBytesToReceive / ts.TotalMilliseconds / 1000).ToString("#0.##"));
|
||||
UpdateCompleted(this, new ResultEventArgs(true, speed));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw e.Error;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
|
@ -219,7 +219,7 @@ namespace v2rayN.Handler
|
|||
|
||||
testCounter++;
|
||||
WebProxy webProxy = new WebProxy(Global.Loopback, httpPort + index);
|
||||
downloadHandle2.DownloadFileAsync(url, webProxy, 20);
|
||||
downloadHandle2.DownloadFileAsync(url, webProxy, 10);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue