Skip to content

Commit

Permalink
Merge pull request #267 from Tantalor93/donotshadow
Browse files Browse the repository at this point in the history
do not share err variable between worker goroutines
  • Loading branch information
Tantalor93 authored Jun 2, 2024
2 parents 037b753 + 044ae2f commit 5e876f3
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions pkg/dnsbench/benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,6 @@ func (b *Benchmark) Run(ctx context.Context) ([]*ResultStats, error) {
st := newResultStats(b)
stats[w] = st

var err error
wg.Add(1)
go func(workerID uint32, st *ResultStats) {
defer func() {
Expand Down Expand Up @@ -400,7 +399,6 @@ func (b *Benchmark) Run(ctx context.Context) ([]*ResultStats, error) {
return
}
}
var resp *dns.Msg

req := dns.Msg{}
req.RecursionDesired = b.Recurse
Expand Down Expand Up @@ -433,7 +431,7 @@ func (b *Benchmark) Run(ctx context.Context) ([]*ResultStats, error) {
start := time.Now()

reqTimeoutCtx, cancel := context.WithTimeout(ctx, b.RequestTimeout)
resp, err = query(reqTimeoutCtx, b.Server, &req)
resp, err := query(reqTimeoutCtx, b.Server, &req)
cancel()
dur := time.Since(start)
if b.RequestLogEnabled {
Expand Down

0 comments on commit 5e876f3

Please sign in to comment.