Commit 0f8cb509 authored by Miek Gieben's avatar Miek Gieben

middleware/file: notify better error reporting

Slightly better errors reporting for failing to sent a notify.
parent fb7fcff9
...@@ -56,10 +56,12 @@ func notify(zone string, to []string) error { ...@@ -56,10 +56,12 @@ func notify(zone string, to []string) error {
return nil return nil
} }
func notifyAddr(c *dns.Client, m *dns.Msg, s string) error { func notifyAddr(c *dns.Client, m *dns.Msg, s string) (err error) {
code := dns.RcodeSuccess ret := new(dns.Msg)
code := dns.RcodeServerFailure
for i := 0; i < 3; i++ { for i := 0; i < 3; i++ {
ret, _, err := c.Exchange(m, s) ret, _, err = c.Exchange(m, s)
if err != nil { if err != nil {
continue continue
} }
...@@ -68,5 +70,8 @@ func notifyAddr(c *dns.Client, m *dns.Msg, s string) error { ...@@ -68,5 +70,8 @@ func notifyAddr(c *dns.Client, m *dns.Msg, s string) error {
return nil return nil
} }
} }
if err != nil {
return err
}
return fmt.Errorf("Notify for zone %q was not accepted by %q: rcode was %q", m.Question[0].Name, s, rcode.ToString(code)) return fmt.Errorf("Notify for zone %q was not accepted by %q: rcode was %q", m.Question[0].Name, s, rcode.ToString(code))
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment