-
Notifications
You must be signed in to change notification settings - Fork 54
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
feat: limit relay connections below max conns #1813
Conversation
4e2f9cc
to
864459f
Compare
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.
LGTM expect the weird phrasing.
var maxRelayPeersValue = 0 | ||
if maxRelayPeers.isSome(): | ||
if maxRelayPeers.get() > maxConnections: | ||
error "Max number of relay peers can't be greater the max amount of connections", |
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.
error "Max number of relay peers can't be greater the max amount of connections", | |
error "Max number of relay peers can't be greater than the max amount of connections", |
phrasing
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.
thanks, all addressed c32672f
error "Max number of relay peers can't be greater the max amount of connections", | ||
maxConnections = maxConnections, | ||
maxRelayPeers = maxRelayPeers.get() | ||
raise newException(Defect, "Max number of relay peers can't be greater the max amount of connections") |
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.
raise newException(Defect, "Max number of relay peers can't be greater the max amount of connections") | |
raise newException(Defect, "Max number of relay peers can't be greater than the max amount of connections") |
phrasing
raise newException(Defect, "Max number of relay peers can't be greater the max amount of connections") | ||
|
||
if maxRelayPeers.get() == maxConnections: | ||
warn "Max number of relay peers is equal to max amount of connections, peer wont be contribute to service peers", |
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.
warn "Max number of relay peers is equal to max amount of connections, peer wont be contribute to service peers", | |
warn "Max number of relay peers is equal to max amount of connections, peer won't be contributing to service peers", |
phrasing
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.
LGTM. Thanks for this. Great to have a way to properly control number of relay vs service slots.
One thing I thought of after reviewing: it seems we only prune relay peers (which makes sense). However, nothing would therefore stop non-relay peers (i.e. client-only peers) from creating inbound connections occupying all slots? Or am I missing something? |
@jm-clius Indeed you are right. For this PR I was considering just relay protocol. Will followup with a PR addressing this. |
30f1865
to
c32672f
Compare
Description
maxInRelayPeers
maxOutRelayPeers
maxConnections
-maxInRelayPeers
-maxOutRelayPeers
slots for service peersmaxRelayPeers
defaults to 80% of themaxConnections
ref
closes #1567