minor changes in concurrent-lookup and dns-find-nameserver-list
This commit is contained in:
parent
34dcb6dc9d
commit
e58dcbd1b3
14
dns.scm
14
dns.scm
|
@ -785,7 +785,9 @@
|
||||||
(let ((l (read-line)))
|
(let ((l (read-line)))
|
||||||
(cond
|
(cond
|
||||||
((eof-object? l)
|
((eof-object? l)
|
||||||
ns)
|
(if (null? ns)
|
||||||
|
(error "dns-find-nameserver-list: no nameserver(s) found in /etc/resolv.conf")
|
||||||
|
ns))
|
||||||
((regexp-search (posix-string->regexp "nameserver[ ]+([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)") l)
|
((regexp-search (posix-string->regexp "nameserver[ ]+([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)") l)
|
||||||
=> (lambda (match)
|
=> (lambda (match)
|
||||||
(loop (append ns (list (match:substring match 1))))))
|
(loop (append ns (list (match:substring match 1))))))
|
||||||
|
@ -807,7 +809,9 @@
|
||||||
(define (concurrent-lookup lookup name)
|
(define (concurrent-lookup lookup name)
|
||||||
(let* ((return 'no-value)
|
(let* ((return 'no-value)
|
||||||
(lock (make-lock))
|
(lock (make-lock))
|
||||||
(queue (make-queue)))
|
(queue (make-queue))
|
||||||
|
(nameserver-list (dns-find-nameserver-list)))
|
||||||
|
|
||||||
|
|
||||||
(obtain-lock lock)
|
(obtain-lock lock)
|
||||||
|
|
||||||
|
@ -823,12 +827,12 @@
|
||||||
(dns-find-nameserver-list))))
|
(dns-find-nameserver-list))))
|
||||||
|
|
||||||
(display "Consumer started\n")
|
(display "Consumer started\n")
|
||||||
(let loop ()
|
(let loop ((count (length nameserver-list)))
|
||||||
(obtain-lock lock)
|
(obtain-lock lock)
|
||||||
(let ((result (dequeue! queue)))
|
(let ((result (dequeue! queue)))
|
||||||
(if result
|
(if (or result (= 1 (length nameserver-list)))
|
||||||
result
|
result
|
||||||
(loop))))))
|
(loop (- count 1)))))))
|
||||||
|
|
||||||
;; checks the arguments of the dns-lookup-* functions.
|
;; checks the arguments of the dns-lookup-* functions.
|
||||||
;; if a nameserver-name is given and not a nameserver-ip
|
;; if a nameserver-name is given and not a nameserver-ip
|
||||||
|
|
Loading…
Reference in New Issue