diff --git a/driver.rkt b/driver.rkt index abfa539..1569875 100644 --- a/driver.rkt +++ b/driver.rkt @@ -64,11 +64,6 @@ (spawn udp-driver) (spawn (nested-vm boot-server))))) -(define (first-only xs) - (if (null? xs) - xs - (list (car xs)))) - (define (handle-request soa-rr zone request) (match-define (dns-request request-message request-source request-sink) request) @@ -133,9 +128,10 @@ ;; TODO: check opcode and direction in request ;; TODO: think again about multiple questions in one packet - (map (lambda (q) - (dns-reply (answer-question q make-reply) request-sink request-source)) - (first-only (dns-message-questions request-message)))) + (match (dns-message-questions request-message) + ['() '()] + [(cons q _) + (list (dns-reply (answer-question q make-reply) request-sink request-source))])) (require "test-rrs.rkt") (start-server (test-port-number) test-soa-rr test-rrs)