-
Notifications
You must be signed in to change notification settings - Fork 18
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
refactoring(p2p/peerTracker): extend conditions for peers handling #165
base: main
Are you sure you want to change the base?
Conversation
d1f04df
to
6c3038a
Compare
8ef32e8
to
4f48548
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #165 +/- ##
=========================================
+ Coverage 0 62.11% +62.11%
=========================================
Files 0 39 +39
Lines 0 3590 +3590
=========================================
+ Hits 0 2230 +2230
- Misses 0 1182 +1182
- Partials 0 178 +178 ☔ View full report in Codecov by Sentry. |
moving to draft until libp2p/go-libp2p#2759 is integrated as it brings improvements to the IdentificationEvent that we rely on. |
4f48548
to
7ae6615
Compare
7ae6615
to
c88c554
Compare
Overview
This PR brings a bunch of improvements to the peer tracker:
ConnManager
. Libp2p provides us with a good mechanism for tracking peers' scores, so I don't see any reason why we shouldn't use it. Now, instead of keeping all peerStats inside the peer tracker, we will store only peers, and constructing peerStats will beon fly
.a. EvtPeerIdentificationCompleted helps to ensure that peer is correct and supports all basic libp2p protocols+ during EvtPeerConnectednessChanged peer store hasn't got information about supported protocols of the incoming peer, so we can't check if the peer supports header-ex protocolID.
b. EvtPeerProtocolsUpdated allows to detect when peer stop/start supporting header-ex protocol.
c. Check if the incoming peer supports a header-ex protocol before storing it.
{err: close called for the closed stream}
. This error was received when we were trying to close the stream after the request had been finished(for quic transport). Stream.Close() does stream.CloseRead() + stream.CloseWrite() internally, so I decided to change Close() -> CloseRead(). PS. The issue has gone.Checklist