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

Projects
None yet
4 participants
@longfin
Copy link
Member

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.
Show resolved Hide resolved CHANGES.md Outdated

@longfin longfin force-pushed the longfin:bugfix/disconnect-turn branch from 10a73a1 to adc4e46 Apr 15, 2019

@codecov-io

This comment has been minimized.

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 longfin requested review from dahlia and earlbread Apr 15, 2019

@longfin longfin force-pushed the longfin:bugfix/disconnect-turn branch from adc4e46 to f1831c9 Apr 15, 2019

@longfin

This comment has been minimized.

Copy link
Member Author

longfin commented Apr 15, 2019

I've rebased.

@@ -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);

This comment has been minimized.

Copy link
@dahlia

dahlia Apr 15, 2019

Member

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

This comment has been minimized.

Copy link
@longfin

longfin Apr 15, 2019

Author Member

It was defined in RFC.

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

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

This comment has been minimized.

Copy link
@dahlia

dahlia Apr 15, 2019

Member

Good to link to that in a comment.

This comment has been minimized.

Copy link
@longfin

longfin Apr 15, 2019

Author Member

I've mentioned.

Show resolved Hide resolved 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

@longfin longfin force-pushed the longfin:bugfix/disconnect-turn branch from ee6913a to 27dd93a Apr 15, 2019

dahlia and others added some commits Apr 15, 2019

Apply suggestions from code review
Co-Authored-By: longfin <longfinfunnel@gmail.com>
Apply suggestions from code review
Co-Authored-By: longfin <longfinfunnel@gmail.com>

@longfin longfin force-pushed the longfin:bugfix/disconnect-turn branch from 27dd93a to a84e576 Apr 15, 2019

@dahlia

dahlia approved these changes Apr 15, 2019

@longfin longfin merged commit 920c7ea into planetarium:master Apr 15, 2019

1 of 2 checks passed

codecov/patch 61.53% of diff hit (target 84.44%)
Details
codecov/project 84.22% (-0.22%) compared to 2317044
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.