mirror of
https://github.com/miekg/dns.git
synced 2025-10-11 18:01:02 +02:00
Prevent a checkInProgressQueriesAtShutdownServer panic (#778)
* Prevent a checkInProgressQueriesAtShutdownServer panic * Fix typo in comment
This commit is contained in:
parent
ac339476d7
commit
39265ac07f
@ -629,6 +629,10 @@ func checkInProgressQueriesAtShutdownServer(t *testing.T, srv *Server, addr stri
|
|||||||
wg.Add(requests)
|
wg.Add(requests)
|
||||||
|
|
||||||
var errOnce sync.Once
|
var errOnce sync.Once
|
||||||
|
// t.Fail will panic if it's called after the test function has
|
||||||
|
// finished. Burning the sync.Once with a defer will prevent the
|
||||||
|
// handler from calling t.Errorf after we've returned.
|
||||||
|
defer errOnce.Do(func() {})
|
||||||
|
|
||||||
HandleFunc("example.com.", func(w ResponseWriter, req *Msg) {
|
HandleFunc("example.com.", func(w ResponseWriter, req *Msg) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user