@@ -18,6 +18,7 @@ import (
18
18
x "github.com/celzero/firestack/intra/backend"
19
19
"github.com/celzero/firestack/intra/core"
20
20
"github.com/celzero/firestack/intra/log"
21
+ "github.com/celzero/firestack/intra/settings"
21
22
"github.com/celzero/firestack/intra/xdns"
22
23
"github.com/miekg/dns"
23
24
)
@@ -316,7 +317,9 @@ func (t *ctransport) hangoverCheckpoint() {
316
317
317
318
func (t * ctransport ) fetch (network string , q * dns.Msg , summary * x.DNSSummary , cb * cache , key string ) (* dns.Msg , error ) {
318
319
sendRequest := func (fsmm * x.DNSSummary ) (* dns.Msg , error ) {
319
- defer core .Recover (core .DontExit , "c.sendRequest: " + t .ID ()+ t .Type ())
320
+ if settings .Debug && rand10pc () {
321
+ panic ("test crash" )
322
+ }
320
323
321
324
fsmm .ID = t .ID ()
322
325
fsmm .Type = t .Type ()
@@ -391,9 +394,9 @@ func (t *ctransport) fetch(network string, q *dns.Msg, summary *x.DNSSummary, cb
391
394
// fallthrough to sendRequest
392
395
} else if cachedsummary != nil {
393
396
if ! isfresh { // not fresh, fetch in the background
394
- go func () {
397
+ core . Go ( "c.sendRequest: " + t . ID () + t . Type (), func () {
395
398
_ , _ = sendRequest (new (x.DNSSummary ))
396
- }( )
399
+ })
397
400
}
398
401
// change summary fields to reflect cached response, except for latency
399
402
fillSummary (cachedsummary , summary )
@@ -496,3 +499,7 @@ func fillSummary(s *x.DNSSummary, other *x.DNSSummary) {
496
499
func rand33pc () bool {
497
500
return rand .Intn (99999 ) < 33000
498
501
}
502
+
503
+ func rand10pc () bool {
504
+ return rand .Intn (99999 ) < 10000
505
+ }
0 commit comments