不使用并发ping
This commit is contained in:
parent
f89d325977
commit
d9afb0e25a
@ -1,6 +1,6 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>2.0.2-SmartIPAddress</Version>
|
<Version>2.0.2</Version>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<Description>github加速神器</Description>
|
<Description>github加速神器</Description>
|
||||||
<Copyright>https://github.com/dotnetcore/FastGithub</Copyright>
|
<Copyright>https://github.com/dotnetcore/FastGithub</Copyright>
|
||||||
|
|||||||
@ -51,19 +51,12 @@ namespace FastGithub.DomainResolve
|
|||||||
/// Ping所有IP
|
/// Ping所有IP
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task PingAllAsync()
|
public async Task PingAllAsync()
|
||||||
{
|
{
|
||||||
var items = this.ToItemArray();
|
foreach (var item in this.ToItemArray())
|
||||||
if (items.Length == 0)
|
|
||||||
{
|
{
|
||||||
return Task.CompletedTask;
|
await item.PingAsync();
|
||||||
}
|
}
|
||||||
if (items.Length == 1)
|
|
||||||
{
|
|
||||||
return items[0].PingAsync();
|
|
||||||
}
|
|
||||||
var tasks = items.Select(item => item.PingAsync());
|
|
||||||
return Task.WhenAll(tasks);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user