mirror of
https://github.com/2dust/v2rayN.git
synced 2025-04-20 06:02:23 +00:00
speedtest
This commit is contained in:
parent
b632dee0ce
commit
88c87aec0e
3 changed files with 23 additions and 9 deletions
|
@ -1257,11 +1257,11 @@ namespace v2rayN.Forms
|
||||||
{
|
{
|
||||||
int httpPort = config.GetLocalPort(Global.InboundHttp);
|
int httpPort = config.GetLocalPort(Global.InboundHttp);
|
||||||
WebProxy webProxy = new WebProxy(Global.Loopback, httpPort);
|
WebProxy webProxy = new WebProxy(Global.Loopback, httpPort);
|
||||||
downloadHandle.DownloadFileAsync(url, webProxy, 60);
|
downloadHandle.DownloadFileAsync(url, webProxy, 600);
|
||||||
}
|
}
|
||||||
else
|
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)
|
void ws_DownloadFileCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (UpdateCompleted != null)
|
if (UpdateCompleted != null)
|
||||||
{
|
{
|
||||||
if (e.Error != null) throw e.Error;
|
if (e.Cancelled)
|
||||||
|
{
|
||||||
((WebClientEx)sender).Dispose();
|
((WebClientEx)sender).Dispose();
|
||||||
TimeSpan ts = (DateTime.Now - totalDatetime);
|
TimeSpan ts = (DateTime.Now - totalDatetime);
|
||||||
string speed = string.Format("<{0} MB/s", (totalBytesToReceive / ts.TotalMilliseconds / 1000).ToString("#0.##"));
|
string speed = string.Format("{0} M/s", (totalBytesToReceive / ts.TotalMilliseconds / 1000).ToString("#0.##"));
|
||||||
UpdateCompleted(this, new ResultEventArgs(true, speed));
|
UpdateCompleted(this, new ResultEventArgs(true, speed));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
catch (Exception ex)
|
||||||
|
|
|
@ -219,7 +219,7 @@ namespace v2rayN.Handler
|
||||||
|
|
||||||
testCounter++;
|
testCounter++;
|
||||||
WebProxy webProxy = new WebProxy(Global.Loopback, httpPort + index);
|
WebProxy webProxy = new WebProxy(Global.Loopback, httpPort + index);
|
||||||
downloadHandle2.DownloadFileAsync(url, webProxy, 20);
|
downloadHandle2.DownloadFileAsync(url, webProxy, 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue