Skip to content

Commit 364b5f1

Browse files
feat(DhtApi): limit number of peers from FindProvidersAsync
1 parent 8391aac commit 364b5f1

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/CoreApi/DhtApi.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ internal DhtApi(IpfsClient ipfs)
2929
return ipfs.IdAsync(id, cancel);
3030
}
3131

32-
public async Task<IEnumerable<Peer>> FindProvidersAsync(Cid id, CancellationToken cancel = default(CancellationToken))
32+
public async Task<IEnumerable<Peer>> FindProvidersAsync(Cid id, int limit = 20, CancellationToken cancel = default(CancellationToken))
3333
{
34-
int limit = 20; // TODO: should be an argument
3534
var stream = await ipfs.PostDownloadAsync("dht/findprovs", cancel, id, $"num-providers={limit}");
3635
return ProviderFromStream(stream, limit);
3736
}

src/IpfsApi.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
</PropertyGroup>
2828

2929
<ItemGroup>
30-
<PackageReference Include="Ipfs.Core" Version="0.34.1" />
30+
<PackageReference Include="Ipfs.Core" Version="0.34.2" />
3131
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
3232
<PackageReference Include="System.Net.Http" Version="4.3.3" Condition="'$(TargetFramework)' == 'netstandard14'" />
3333
<PackageReference Include="System.Net.Http" Version="4.3.3" Condition="'$(TargetFramework)' == 'net45'" />

0 commit comments

Comments
 (0)