fix crash issue when unknown network type

main
fangdingjun 7 years ago
parent bed437d038
commit dc19c58c54

@ -98,21 +98,22 @@ func (h *dnsHandler) queryUpstream(r *dns.Msg, srv addr, ch chan *dns.Msg) {
srv.Port) srv.Port)
m, _, err = h.httpscf.Exchange(r, srv.Host) m, _, err = h.httpscf.Exchange(r, srv.Host)
default: default:
// ignore err = fmt.Errorf("not supported type %s", srv.Network)
}
if err != nil {
log.Errorf("%s", err)
return
} }
if err == nil {
select { select {
case ch <- m: case ch <- m:
default: default:
} }
} else {
log.Errorf("%s", err)
}
} }
func (h *dnsHandler) getAnswerFromUpstream(r *dns.Msg, servers []addr) (*dns.Msg, error) { func (h *dnsHandler) getAnswerFromUpstream(r *dns.Msg, servers []addr) (*dns.Msg, error) {
ch := make(chan *dns.Msg, 5) ch := make(chan *dns.Msg, len(servers))
for _, srv := range servers { for _, srv := range servers {
go func(a addr) { go func(a addr) {
h.queryUpstream(r, a, ch) h.queryUpstream(r, a, ch)

Loading…
Cancel
Save