Sending an empty packet to the proxy causes it to dump its current cache contents, for debugging

This commit is contained in:
Tony Garnock-Jones 2012-02-16 15:25:43 -05:00
parent 0c3ebff5f1
commit 8d715290ee
2 changed files with 17 additions and 0 deletions

View File

@ -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

View File

@ -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)))]