Handle abnormal response codes properly

This commit is contained in:
Tony Garnock-Jones 2012-02-17 16:05:18 -05:00
parent 8571900d29
commit 231e297975
1 changed files with 10 additions and 4 deletions

View File

@ -133,7 +133,11 @@
(f (dns-message-authorities message))
(f (dns-message-additional message)))]
[(name-error) #f]
[else 'no-answer]))
[else
(begin (write `(Abnormal response-code ,(dns-message-response-code message) received
in response to questions ,(dns-message-questions message)))
(newline))
'no-answer]))
;; IPv4 -> String
(define (ip->host-name ip-address)
@ -201,9 +205,11 @@
(unsubscribe rpc-id))])))]))
(define (on-answer w ans)
(transition w
(send-message (network-reply (network-request-unique-id (network-query-state-request w))
ans))))
(if (eq? ans 'no-answer) ;; can come from filter-dns-reply
(try-next-server w)
(transition w
(send-message (network-reply (network-request-unique-id (network-query-state-request w))
ans)))))
(define (send-request w query-id timeout server-ip)
(match-define (network-request s q zone-origin _ _) (network-query-state-request w))