diff --git a/os-dns.rkt b/os-dns.rkt index 0d704d3..e190c9a 100644 --- a/os-dns.rkt +++ b/os-dns.rkt @@ -22,6 +22,10 @@ (os-big-bang 'no-state (subscribe 'packet-reader (meta-message-handlers w + [(udp-packet source (== s) #"") + (display "Debug dump packet received\n") + (transition w + (send-message `(debug-dump)))] [(udp-packet source (== s) body) (transition w (send-message diff --git a/proxy.rkt b/proxy.rkt index 29a93f0..cfb0ec8 100644 --- a/proxy.rkt +++ b/proxy.rkt @@ -145,6 +145,19 @@ ;; TODO: consider deduping questions here too? (subscribe 'question-handler-factory (message-handlers zone + [`(debug-dump) + (with-output-to-file "zone-proxy.dump" + (lambda () + (display "----------------------------------------------------------------------\n") + (display (seconds->date (current-seconds))) + (newline) + (for* ([(domain rrmap) zone] [(rr expiry) rrmap]) + (write (list rr expiry)) + (newline)) + (newline)) + #:mode 'text + #:exists 'append) + zone] [(? question? q) (transition zone (spawn (question-handler zone q client-sock)))]