Skip to content

Commit

Permalink
Tune BindingProxies
Browse files Browse the repository at this point in the history
- Increase concurrency
- Remove unecessary assertion
  • Loading branch information
longfin committed Dec 27, 2019
1 parent bac76b9 commit 1cc15b3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ To be released.
in the same chain, since these virtually never become valid. [[#721], [#728]]
- `Swarm<T>` became not to fill blocks if received block hashes are
continuous. [[#732]]
- `Swarm<T>` became to can process more requests at once by creating TURN
relaying proxy concurrently. [[TBD]]

### Bug fixes

Expand Down
5 changes: 3 additions & 2 deletions Libplanet/Net/Swarm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
Expand Down Expand Up @@ -449,6 +448,9 @@ public async Task StartAsync(
);
EndPoint = new DnsEndPoint(turnEp.Address.ToString(), turnEp.Port);

// FIXME should be parameterized
tasks.Add(BindingProxies(_cancellationToken));
tasks.Add(BindingProxies(_cancellationToken));
tasks.Add(BindingProxies(_cancellationToken));
tasks.Add(RefreshAllocate(_cancellationToken));
tasks.Add(RefreshPermissions(_cancellationToken));
Expand Down Expand Up @@ -1190,7 +1192,6 @@ private async Task BindingProxies(CancellationToken cancellationToken)
{
using (var proxy = new NetworkStreamProxy(stream))
{
Debug.Assert(_listenPort != null, nameof(_listenPort) + " != null");
await proxy.StartAsync(IPAddress.Loopback, _listenPort.Value);
}
}).ContinueWith(_ => stream.Dispose());
Expand Down

0 comments on commit 1cc15b3

Please sign in to comment.