-
Notifications
You must be signed in to change notification settings - Fork 43
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
gs1.1 outbound mesh quota #91
Conversation
d71c258
to
5c6df19
Compare
Codecov Report
@@ Coverage Diff @@
## gsv1.1 #91 +/- ##
=======================================
Coverage 80.00% 80.00%
=======================================
Files 1 1
Lines 10 10
=======================================
Hits 8 8
Misses 2 2 Continue to review full report at Codecov.
|
let outbound = false | ||
for (const c of this._connectionManager.getAll(peerId)) { | ||
if (c.stat.direction === 'outbound') { | ||
if (Array.from(c.registry.values()).some(rvalue => protocols.includes(rvalue.protocol))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't great, not sure what the best way to do this is.
Trying to ensure that gossipsub is one of the protocols of one of the streams on the connection (considering that there may be multiple connections for a peer, not all containing a gossipsub stream)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
humm, yeah!
Maybe the connection could provide an utility API to check if it has open streams using a given protocol.
I will add to my TODO list to consider and implement it. Meanwhile, we can go this way
} | ||
|
||
export interface ConnectionManager { | ||
getAll(id: string): Connection[] | ||
getAll(peerId: PeerId): Connection[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was a mistake that got through, fixed here and below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good!
Update deps to support no-copy operations
## [3.0.4](libp2p/js-libp2p-pubsub@v3.0.3...v3.0.4) (2022-08-01) ### Trivial Changes * update project config ([ChainSafe#86](libp2p/js-libp2p-pubsub#86)) ([3251829](libp2p/js-libp2p-pubsub@3251829)) ### Dependencies * update it-length-prefixed and uint8arraylists deps ([ChainSafe#91](libp2p/js-libp2p-pubsub#91)) ([f295fce](libp2p/js-libp2p-pubsub@f295fce))
Implements
https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.1.md#outbound-mesh-quotas
https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.1.md#heartbeat-maintenance
https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.1.md#spam-protection-measures
GRAFT
spam protectionMost of these edits made directly in line with the go-libp2p-pubsub impl. https://github.com/libp2p/go-libp2p-pubsub/blob/master/gossipsub.go
I tried to avoid rewriting / adding all features, so there are some conditionals/blocks that aren't yet included (eg: direct peers, graft/prune backoff tracking, px, etc)
Big updates:
_addPeer
,_removePeer
outbound
cache for peer_handleGraft
heartbeat
test/gossip.js