@@ -350,30 +350,24 @@ func (t *ctransport) hangoverCheckpoint() {
350350}
351351
352352func (t * ctransport ) fetch (network string , q * dns.Msg , summary * x.DNSSummary , cb * cache , key string ) (* dns.Msg , error ) {
353- sendRequest := func (fsmm * x.DNSSummary ) (* dns.Msg , error ) {
354- fsmm .QName = summary .QName
355- fsmm .QType = summary .QType
356- fsmm .ID = t .ID ().V ()
357- fsmm .Type = t .Type ().V ()
358-
353+ sendRequest := func (smm2 * x.DNSSummary ) (* dns.Msg , error ) {
359354 reqsent := false
360355
361356 defer func () {
362357 // fill after summaries are filled
363358 if ! reqsent {
364- summary .ID = t .ID ().V ()
365- fsmm .Cached = true
359+ smm2 .Cached = true
366360 }
367361 }()
368362
369- cc := & cres {ans : nil , s : copySummary (fsmm )}
363+ cc := & cres {ans : nil , s : copySummary (smm2 )}
370364 v , err := t .reqbarrier .DoIt (key , func () (_ * cres , qerr error ) {
371365 reqsent = true
372366 // ans may be nil
373- cc .ans , qerr = Req (t .Transport , network , q , fsmm )
367+ cc .ans , qerr = Req (t .Transport , network , q , smm2 )
374368 t .hangoverCheckpoint ()
375369 // cb.put no-ops when ans is nil or xdns.Len(ans) is 0
376- cb .put (key , cc .ans , fsmm )
370+ cb .put (key , cc .ans , smm2 )
377371 return cc , qerr
378372 })
379373
@@ -398,20 +392,20 @@ func (t *ctransport) fetch(network string, q *dns.Msg, summary *x.DNSSummary, cb
398392 log .W ("cache: barrier: hangover(k: %s); sent? %t, discard ans (has? %t)" ,
399393 key , reqsent , hasans )
400394 if cachehit {
401- fillSummary (cachedres .s , fsmm )
395+ fillSummary (cachedres .s , smm2 )
402396 }
403397 // mimic send fail
404- fsmm .Msg = err .Error ()
405- fsmm .RCode = dns .RcodeServerFailure
406- fsmm .Status = SendFailed
398+ smm2 .Msg = err .Error ()
399+ smm2 .RCode = dns .RcodeServerFailure
400+ smm2 .Status = SendFailed
407401 // do not return any response (stall / drop silently)
408402 return nil , err
409403 }
410404
411405 // fres may be nil
412406 fres , cachedsmm , ferr := asResponse (q , cachedres , fresh )
413407 if cachehit { // fill from cachedsmm despite any err if cache was hit
414- fillSummary (cachedsmm , fsmm ) // cachedsmm may itself be fsmm
408+ fillSummary (cachedsmm , smm2 ) // cachedsmm may itself be smm2
415409 }
416410
417411 return fres , core .JoinErr (err , ferr )
@@ -434,8 +428,8 @@ func (t *ctransport) fetch(network string, q *dns.Msg, summary *x.DNSSummary, cb
434428 if err != nil {
435429 log .W ("cache: hit(k: %s) %s, but err? %v" , key , v , err )
436430 if err == errCacheResponseMismatch {
437- // FIXME: this is a hack to fix the issue where the cache
438- // returns a response that does not match the query.
431+ // FIXME: this is a hack to fix an issue where the cache
432+ // returns a response that does not match the fqdn in query.
439433 cb .mu .Lock ()
440434 delete (cb .c , key ) // del the corrupted entry
441435 cb .mu .Unlock ()
@@ -452,7 +446,7 @@ func (t *ctransport) fetch(network string, q *dns.Msg, summary *x.DNSSummary, cb
452446 if testpanic {
453447 panic ("dns: cache: fetch: sendRequest: rand10pc" )
454448 }
455- _ , _ = sendRequest (new (x. DNSSummary )) // summary may be cached
449+ _ , _ = sendRequest (copySummary ( summary )) // summary may be cached
456450 })
457451 }
458452 // change summary fields to reflect cached response, except for latency
0 commit comments