From e58dcbd1b381c3aaa5034d6709396f9edc5134df Mon Sep 17 00:00:00 2001 From: cresh Date: Wed, 8 May 2002 14:55:55 +0000 Subject: [PATCH] minor changes in concurrent-lookup and dns-find-nameserver-list --- dns.scm | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/dns.scm b/dns.scm index e71dd02..616c32c 100644 --- a/dns.scm +++ b/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