Check server TCP conn exists before reading

w.tcp could be nil if the conn has been closed by a handler.
This commit is contained in:
Andrew Tunnell-Jones 2015-11-26 08:10:55 +00:00
parent cfa72d0862
commit 3062dcb751
1 changed files with 3 additions and 0 deletions

View File

@ -535,6 +535,9 @@ Redo:
h.ServeDNS(w, req) // Writes back to the client
Exit:
if w.tcp == nil {
return
}
// TODO(miek): make this number configurable?
if q > maxTCPQueries { // close socket after this many queries
w.Close()