Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Swarm<T> constructor #581

Merged
merged 5 commits into from
Oct 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ To be released.
- Added `BencodexExtension` static class.
- Removed `BlockChain<T>.Blocks`. [[#409], [#583]]
- Removed `BlockChain<T>.Transactions`. [[#409], [#583]]
- Removed the `linger` parameter from the `Swarm<T>()` constructor, and added
the `waitFor` parameter to `Swarm<T>.StopAsync()` method instead. [[#581]]
- Removed the `dialTimeout` parameter from the `Swarm<T>`() constructor, and
added it to `Swarm<T>.PreloadAsync()` & `Swarm<T>.StartAsync()` methods.
[[#581]]

### Added interfaces

Expand Down Expand Up @@ -80,6 +85,7 @@ To be released.
[#566]: https://github.com/planetarium/libplanet/pull/566
[#575]: https://github.com/planetarium/libplanet/pull/575
[#576]: https://github.com/planetarium/libplanet/pull/576
[#581]: https://github.com/planetarium/libplanet/pull/581
[#583]: https://github.com/planetarium/libplanet/pull/583


Expand Down
12 changes: 3 additions & 9 deletions Libplanet.Tests/Net/SwarmTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,6 @@ public async Task RoutingTableFull()
blockchain,
new PrivateKey(),
appProtocolVersion: 1,
dialTimeout: TimeSpan.FromMilliseconds(15000),
linger: TimeSpan.FromMilliseconds(1000),
tableSize: 1,
bucketSize: 1,
host: IPAddress.Loopback.ToString());
Expand Down Expand Up @@ -473,8 +471,6 @@ public async Task ReplacementCache()
blockchain,
new PrivateKey(),
appProtocolVersion: 1,
dialTimeout: TimeSpan.FromMilliseconds(15000),
linger: TimeSpan.FromMilliseconds(1000),
tableSize: 1,
bucketSize: 1,
host: IPAddress.Loopback.ToString());
Expand Down Expand Up @@ -527,8 +523,6 @@ public async Task RemoveDeadReplacementCache()
blockchain,
new PrivateKey(),
appProtocolVersion: 1,
dialTimeout: TimeSpan.FromMilliseconds(15000),
linger: TimeSpan.FromMilliseconds(1000),
tableSize: 1,
bucketSize: 1,
host: IPAddress.Loopback.ToString());
Expand Down Expand Up @@ -1602,7 +1596,7 @@ public async Task Preload()
await receiverSwarm.AddPeersAsync(new[] { minerSwarm.AsPeer }, null);

minerSwarm.FindNextHashesChunkSize = 2;
await receiverSwarm.PreloadAsync(progress);
await receiverSwarm.PreloadAsync(TimeSpan.FromSeconds(15), progress);

Assert.Equal(minerChain.AsEnumerable(), receiverChain.AsEnumerable());

Expand Down Expand Up @@ -1689,7 +1683,7 @@ public async Task PreloadFromNominer()
await nominerSwarm1.AddPeersAsync(new[] { nominerSwarm0.AsPeer }, null);
await nominerSwarm1.PreloadAsync();
await receiverSwarm.AddPeersAsync(new[] { nominerSwarm1.AsPeer }, null);
await receiverSwarm.PreloadAsync(progress);
await receiverSwarm.PreloadAsync(TimeSpan.FromSeconds(15), progress);

Assert.Equal(minerChain.AsEnumerable(), receiverChain.AsEnumerable());

Expand Down Expand Up @@ -2181,7 +2175,7 @@ private async Task<Task> StartAsync<T>(
)
where T : IAction, new()
{
Task task = swarm.StartAsync(200, cancellationToken);
Task task = swarm.StartAsync(200, 200, cancellationToken);
await swarm.WaitForRunningAsync();
return task;
}
Expand Down
Loading