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

Fix disconnecting on TURN relay session #198

Merged
merged 6 commits into from
Apr 15, 2019

Conversation

longfin
Copy link
Member

@longfin longfin commented Apr 14, 2019

This PR aids problem the problem of TURN relay session being disconnected. if the TURN server doesn't receive CreatePermission on time, it deletes the registered peer and rejects any request from that. to prevent this, I added a task that iterates CreatePermission.

It also fixes the following issues:

  • Fixed a bug that Swarm attempted to use TURN relay even though _host was given.
  • Adjusted a lock in Append() to increase parallelism.

CHANGES.md Outdated Show resolved Hide resolved
@codecov-io
Copy link

codecov-io commented Apr 15, 2019

Codecov Report

Merging #198 into master will decrease coverage by 0.21%.
The diff coverage is 61.53%.

@@            Coverage Diff             @@
##           master     #198      +/-   ##
==========================================
- Coverage   84.44%   84.22%   -0.22%     
==========================================
  Files          72       72              
  Lines        3350     3367      +17     
==========================================
+ Hits         2829     2836       +7     
- Misses        521      531      +10
Impacted Files Coverage Δ
Libplanet/Net/NetworkStreamProxy.cs 0% <0%> (ø) ⬆️
Libplanet/Blockchain/BlockChain.cs 99.23% <100%> (+0.01%) ⬆️
Libplanet/Net/Swarm.cs 81.73% <18.18%> (-0.82%) ⬇️

@longfin
Copy link
Member Author

longfin commented Apr 15, 2019

I've rebased.

earlbread
earlbread previously approved these changes Apr 15, 2019
@@ -33,6 +33,9 @@ public partial class Swarm : ICollection<Peer>, IDisposable
private static readonly TimeSpan TurnAllocationLifetime =
TimeSpan.FromSeconds(777);

private static readonly TimeSpan TurnPermissionLifetime =
TimeSpan.FromMinutes(5);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this time interval defined by the specification, or just arbitrary? If it's arbitrary, it would be good to parametrize this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was defined in RFC.

The Permission Lifetime MUST be 300 seconds (= 5 minutes).

https://tools.ietf.org/html/rfc5766#section-8

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to link to that in a comment.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've mentioned.

CHANGES.md Outdated Show resolved Hide resolved
CHANGES.md Outdated Show resolved Hide resolved
CHANGES.md Outdated Show resolved Hide resolved
Libplanet/Net/Swarm.cs Outdated Show resolved Hide resolved
Libplanet/Net/Swarm.cs Outdated Show resolved Hide resolved
dahlia and others added 2 commits April 15, 2019 20:32
Co-Authored-By: longfin <longfinfunnel@gmail.com>
Co-Authored-By: longfin <longfinfunnel@gmail.com>
@longfin longfin merged commit 920c7ea into planetarium:master Apr 15, 2019
limebell pushed a commit to limebell/libplanet that referenced this pull request Jul 7, 2021
…changed-state

Reduce GetState, SetState call count in IAction.Execute
OnedgeLee pushed a commit to OnedgeLee/libplanet that referenced this pull request Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants