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)))
|
||||
(cond
|
||||
((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)
|
||||
=> (lambda (match)
|
||||
(loop (append ns (list (match:substring match 1))))))
|
||||
|
@ -807,7 +809,9 @@
|
|||
(define (concurrent-lookup lookup name)
|
||||
(let* ((return 'no-value)
|
||||
(lock (make-lock))
|
||||
(queue (make-queue)))
|
||||
(queue (make-queue))
|
||||
(nameserver-list (dns-find-nameserver-list)))
|
||||
|
||||
|
||||
(obtain-lock lock)
|
||||
|
||||
|
@ -823,12 +827,12 @@
|
|||
(dns-find-nameserver-list))))
|
||||
|
||||
(display "Consumer started\n")
|
||||
(let loop ()
|
||||
(let loop ((count (length nameserver-list)))
|
||||
(obtain-lock lock)
|
||||
(let ((result (dequeue! queue)))
|
||||
(if result
|
||||
(if (or result (= 1 (length nameserver-list)))
|
||||
result
|
||||
(loop))))))
|
||||
(loop (- count 1)))))))
|
||||
|
||||
;; checks the arguments of the dns-lookup-* functions.
|
||||
;; if a nameserver-name is given and not a nameserver-ip
|
||||
|
|
Loading…
Reference in New Issue