From f9978346e73359ac1d8b88c9ed874edc7225582b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 18 Dec 2020 18:10:04 +0100 Subject: avahi: Remove poll timeout when possible. Fixes . * guix/avahi.scm (avahi-browse-service-thread): Change timeout default value to false when no "stop-loop?" procedure is passed. Adapt "iterate-simple-poll" call accordingly. Signed-off-by: Mathieu Othacehe --- guix/avahi.scm | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'guix/avahi.scm') diff --git a/guix/avahi.scm b/guix/avahi.scm index aa90a5cdd4..132e42f268 100644 --- a/guix/avahi.scm +++ b/guix/avahi.scm @@ -89,13 +89,19 @@ when STOP-LOOP? procedure returns true." (close-port socket) ip)) +(define never + ;; Never true. + (const #f)) + (define* (avahi-browse-service-thread proc #:key types (ignore-local? #t) (family AF_INET) - (stop-loop? (const #f)) - (timeout 100)) + (stop-loop? never) + (timeout (if (eq? stop-loop? never) + #f + 100))) "Browse services which type is part of the TYPES list, using Avahi. The search is restricted to services with the given FAMILY. Each time a service is found or removed, PROC is called and passed as argument the corresponding @@ -167,4 +173,6 @@ when STOP-LOOP? procedure returns true." client-callback))) (and (client? client) (while (not (stop-loop?)) - (iterate-simple-poll poll timeout))))) + (if timeout + (iterate-simple-poll poll timeout) + (iterate-simple-poll poll)))))) -- cgit v1.2.3