-
Notifications
You must be signed in to change notification settings - Fork 381
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
Peer hashcode fix #194
Open
pyckle
wants to merge
7
commits into
atomashpolskiy:master
Choose a base branch
from
pyckle:peer_hashcode_fix
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Peer hashcode fix #194
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pyckle
force-pushed
the
peer_hashcode_fix
branch
from
October 18, 2021 22:38
8f40a0e
to
1ec126d
Compare
Codecov Report
@@ Coverage Diff @@
## master #194 +/- ##
============================================
+ Coverage 65.72% 68.05% +2.33%
- Complexity 2378 2512 +134
============================================
Files 309 313 +4
Lines 10339 10465 +126
Branches 1144 1143 -1
============================================
+ Hits 6795 7122 +327
+ Misses 2871 2647 -224
- Partials 673 696 +23
|
pyckle
force-pushed
the
peer_hashcode_fix
branch
from
October 19, 2021 14:14
21527b1
to
009242b
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Separate Peer into InetPeer (for remote peer), LocalPeer (for the local peer information, and ImmutablePeer for lists of peers that are obtained or sent via peer sharing mechanisms (tracker, PEx, etc.)
InetPeer is not suitable for using as a Map key because it is mutable, including the remote port. The remote port for incoming connections is not known until the extended handshake is completed.
Many extension modules implemented must store state on a per peer basis - it is required by many extension specifications. However the implementations that use Map<Peer, State> are clumsy. These maps must be cleaned whenever a peer disconnects.
This has been solved by adding an additional state map in the ConnectionState object that takes a state class and returns its instance for the peer.
Also, many modules have a common check they need to do - check whether the module is supported by the remote peer. The state of supported modules is now stored in the Peer object, to eliminate the need for all of the modules to consume the ExtendedHandshake message. Also, removing support for protocols is now supported.
PEx now shares additional information about peers. It shares whether they are seeding, whether they are using encryption, as well as whether our connection to them is outgoing or incoming. uTP and hole punching are still not implemented.