Replace use of first-only with match
This commit is contained in:
parent
1c3ebd17bd
commit
87943e435b
12
driver.rkt
12
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)
|
||||
|
|
Loading…
Reference in New Issue