aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2023-07-06 11:56:53 +0200
committerLudovic Courtès <ludo@gnu.org>2023-07-07 15:30:21 +0200
commit0ae419877ce070721f8e5404c2fe7d721a22f998 (patch)
treebd40936c3c7fe3c993421f2ccf595e045292e58f
parentba1fe203b293469e8db1a78e5090ecc711aaaba2 (diff)
downloadguix-0ae419877ce070721f8e5404c2fe7d721a22f998.tar.gz
guix-0ae419877ce070721f8e5404c2fe7d721a22f998.zip
avahi: Poll less.
* guix/avahi.scm (avahi-publish-service-thread): Have #:timeout default to #f when 'stop-loop?' is NEVER, or 500ms. (avahi-browse-service-thread): #:timeout defaults to 500ms when 'stop-loop?' is provided.
-rw-r--r--guix/avahi.scm16
1 files changed, 9 insertions, 7 deletions
diff --git a/guix/avahi.scm b/guix/avahi.scm
index cb0c85f9f4..502b0b9dcd 100644
--- a/guix/avahi.scm
+++ b/guix/avahi.scm
@@ -49,11 +49,17 @@
(port avahi-service-port)
(txt avahi-service-txt))
+(define never
+ ;; Never true.
+ (const #f))
+
(define* (avahi-publish-service-thread name
#:key
type port
- (stop-loop? (const #f))
- (timeout 100)
+ (stop-loop? never)
+ (timeout (if (eq? stop-loop? never)
+ #f
+ 500))
(txt '()))
"Publish the service TYPE using Avahi, for the given PORT, on all interfaces
and for all protocols. Also, advertise the given TXT record list.
@@ -89,10 +95,6 @@ when STOP-LOOP? procedure returns true."
(close-port socket)
ip))
-(define never
- ;; Never true.
- (const #f))
-
(define* (avahi-browse-service-thread proc
#:key
types
@@ -101,7 +103,7 @@ when STOP-LOOP? procedure returns true."
(stop-loop? never)
(timeout (if (eq? stop-loop? never)
#f
- 100)))
+ 500)))
"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