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

Make MaxTCPQueries configurable #673

Merged
merged 1 commit into from
May 14, 2018
Merged

Conversation

UladzimirTrehubenka
Copy link
Contributor

No description provided.

@codecov-io
Copy link

codecov-io commented May 7, 2018

Codecov Report

Merging #673 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #673      +/-   ##
==========================================
+ Coverage   58.14%   58.15%   +0.01%     
==========================================
  Files          37       37              
  Lines       10017    10020       +3     
==========================================
+ Hits         5824     5827       +3     
  Misses       3145     3145              
  Partials     1048     1048
Impacted Files Coverage Δ
server.go 62.07% <100%> (+0.29%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a93f3e4...77075aa. Read the comment docs.

server.go Outdated
@@ -12,9 +12,6 @@ import (
"time"
)

// Maximum number of TCP queries before we close the socket.
const maxTCPQueries = 128
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should expose this in the server, and make 0 mean; disable this.

By removing this the server has no way to kill a client after it things it has enough; Google Public DNS does the same thing btw, so it's not uncommon to have this.

@UladzimirTrehubenka UladzimirTrehubenka changed the title Remove TCP packets limit Make MaxTCPQueries configurable May 10, 2018
server.go Outdated
// TODO(miek): make maxTCPQueries configurable?
for q := 0; q < maxTCPQueries; q++ {
q := 0
for {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would come out cleaner written as:

for q := 0; q < srv.MaxTCPQueries || srv.MaxTCPQueries == 0; q++ {

server.go Outdated
@@ -303,6 +300,8 @@ type Server struct {
DecorateReader DecorateReader
// DecorateWriter is optional, allows customization of the process that writes raw DNS messages.
DecorateWriter DecorateWriter
// Maximum number of TCP queries before we close the socket (unlimited if 0).
MaxTCPQueries int
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I question whether having the default value mean unlimited is best, because it amounts to a behaviour change that could be unexpected. Perhaps it would be best to have 0 mean the current max of 128 and -1 explicitly mean unlimited (maybe even with a const UnlimitedMaxQueries = -1 for clarity). @miekg thougts?

@miekg
Copy link
Owner

miekg commented May 10, 2018 via email

Copy link
Collaborator

@tmthrgd tmthrgd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two small nits, both a subjective and neither are blocking.

@@ -13,7 +13,7 @@ import (
"time"
)

// Maximum number of TCP queries before we close the socket.
// Default maximum number of TCP queries before we close the socket.
const maxTCPQueries = 128
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be renamed defaultMaxTCPQueries, but I can't say I love the name. Maybe it's fine as it is 🤷‍♂️.

@@ -303,6 +303,8 @@ type Server struct {
DecorateReader DecorateReader
// DecorateWriter is optional, allows customization of the process that writes raw DNS messages.
DecorateWriter DecorateWriter
// Maximum number of TCP queries before we close the socket. Default is maxTCPQueries (unlimited if -1).
MaxTCPQueries int
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little hesitant about using a magic number here, but it's not blocking to me. (I still like something like const UnlimitedMaxQueries = -1 simply for the clarity it gives).

@miekg miekg merged commit 621df09 into miekg:master May 14, 2018
@UladzimirTrehubenka UladzimirTrehubenka deleted the nolimit branch May 16, 2018 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants