aboutsummaryrefslogtreecommitdiff
path: root/guix/avahi.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-12-18 18:10:04 +0100
committerMathieu Othacehe <othacehe@gnu.org>2020-12-20 10:40:57 +0100
commitf9978346e73359ac1d8b88c9ed874edc7225582b (patch)
treed54a840a71449b2d04f07420ee6b6011c586ad51 /guix/avahi.scm
parente03552d5d4d974dadca8138efa3ba4b337c48b85 (diff)
downloadguix-f9978346e73359ac1d8b88c9ed874edc7225582b.tar
guix-f9978346e73359ac1d8b88c9ed874edc7225582b.tar.gz
avahi: Remove poll timeout when possible.
Fixes <https://issues.guix.gnu.org/45314>. * 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 <othacehe@gnu.org>
Diffstat (limited to 'guix/avahi.scm')
-rw-r--r--guix/avahi.scm14
1 files changed, 11 insertions, 3 deletions
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))))))