-
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
feat: limit connection by measurement #459
Conversation
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.
Others LGTM
derive/src/derives.rs
Outdated
#[cfg(not(feature = "core_crate"))] | ||
quote! { | ||
use rings_core::measure::measure::MessageRecvBehaviour; | ||
use rings_core::measure::measure::MessageSendehaviour; |
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.
use rings_core::measure::measure::MessageSendehaviour; | |
use rings_core::measure::measure::MessageSendBehaviour; |
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.
fixed
disconn, | ||
conn - disconn | ||
); | ||
((conn - disconn) as i16) < THRESHOLD |
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.
To ensure adaptability across different orders of magnitude, it may be more effective to calculate using the admission base and ratio rather than simply taking the difference.
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.
Agree, this algorithm is just a very basically impl for current situation, we needs ratio based, time weighted based and so on. And futher more, we allow users to compose those impls together.
Please check if the PR fulfills these requirements
🔵 What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
feature
🟤 What is the current behavior? (You can also link to an open issue here)
related issue #399
In the current scenario, the DHT may attempt to establish a connection to did_a, but this can fail due to incorrect configuration or network issues. The existing implementation might repeatedly try to establish the connection, potentially causing the system's file descriptor limit to be reached very quickly.
🟢 What is the new behavior (if this is a feature change)?
good
.connect
,connect_via
anddisconnect
.☢️ Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
No
ℹ️ Other information
After this modify, if a node is behaviour no good, it will printout errors.
Closes #issue