Restore dns on unclean shutdown (#1494)

This commit is contained in:
Viktor Liu
2024-01-30 09:58:56 +01:00
committed by GitHub
parent 9c56f74235
commit 846d486366
29 changed files with 660 additions and 143 deletions

View File

@@ -31,10 +31,13 @@ func (r *responseWriter) RemoteAddr() net.Addr {
func (r *responseWriter) WriteMsg(msg *dns.Msg) error {
buff, err := msg.Pack()
if err != nil {
return err
return fmt.Errorf("pack: %w", err)
}
_, err = r.Write(buff)
return err
if _, err := r.Write(buff); err != nil {
return fmt.Errorf("write: %w", err)
}
return nil
}
// Write writes a raw buffer back to the client.