-
Notifications
You must be signed in to change notification settings - Fork 3
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
Refactor peerRefreshDNS() to clarify its (void*)1 logic #274
Conversation
and also polished, reducing duplication.
src/neighbors.cc
Outdated
/* Reconfigure the peers every hour */ | ||
eventAddIsh("peerRefreshDNS", peerRefreshDNS, nullptr, 3600.0, 1); | ||
static void | ||
peerScheduleDnsRefreshCheck(const double delayInSeconds) |
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.
Please try to move this up, where the old eventFind() was, to simplify the diff.
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.
Moved.
src/neighbors.cc
Outdated
|
||
static void | ||
peerDnsRefreshCheck(void *data) | ||
{ | ||
if (!data && 0 == stat5minClientRequests()) { |
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.
I assume you are working on removing data
from this condition and will come back to this PR after that is done.
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.
Done.
src/neighbors.cc
Outdated
|
||
/* Reconfigure the peers every hour */ |
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.
Let's drop this misleading comment. This self-documented code is not reconfiguring cache_peers. The only problem here is that 3600.0 constant lacks "this is an hour" annotation, but that will be fixed when we migrate this code to std::chrono.
/* Reconfigure the peers every hour */ |
that will be fixed when we migrate this code to std::chrono
I do not think we should migrate in this PR, but we will migrate if others insist.
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.
Removed.
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.
Nice, thank you.
This work became official PR 1950. |
Creating a raw pointer with 1 as an address/value raised red flags, and
it was difficult to interpret tricky peerRefreshDNS() logic correctly.