Skip to content
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

Simplify upstream percentage computation #422

Merged
merged 1 commit into from
Nov 24, 2018

Conversation

DL6ER
Copy link
Member

@DL6ER DL6ER commented Nov 24, 2018

By submitting this pull request, I confirm the following (please check boxes, eg [X]) Failure to fill the template will close your PR:

Please submit all pull requests against the development branch. Failure to do so will delay or deny your request

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • I have considered, and confirmed that this submission will be valuable to others.
  • I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  • I give this submission freely, and claim no ownership to its content.

How familiar are you with the codebase?:

10


Simplify upstream percentage computation.

The way we compute the forward destination percentage is a leftover from pre-v3.0 times. Back then we counted each forwarded to ... line as one forwarded query. With v3.0, we started to skip duplicated forwarded to ... lines as we had now the query IDs and were able to rule out what was a duplicate.

This check is now here:

FTL/dnsmasq_interface.c

Lines 275 to 286 in da8c276

// Proceed only if
// - current query has not been marked as replied to so far
// (it could be that answers from multiple forward
// destionations are coimg in for the same query)
// - the query was formally known as cached but had to be forwarded
// (this is a special case further described below)
if(queries[i].complete && queries[i].status != QUERY_CACHE)
{
free(forward);
disable_thread_lock();
return;
}

Hence, forwardedsum happens to exactly cancel out with counters->forwardedqueries such that the computation can be simplified but still gives the exact same result in all cases.

This template was created based on the work of udemy-dl.

Signed-off-by: DL6ER <dl6er@dl6er.de>
@DL6ER DL6ER added this to the v4.2 milestone Nov 24, 2018
@AzureMarker AzureMarker merged commit 61afb93 into development Nov 24, 2018
@AzureMarker AzureMarker deleted the tweak/forwardpercentage branch November 24, 2018 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants