guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: avahi: Remove poll timeout when possible.


From: guix-commits
Subject: branch master updated: avahi: Remove poll timeout when possible.
Date: Sun, 20 Dec 2020 04:41:22 -0500

This is an automated email from the git hooks/post-receive script.

mothacehe pushed a commit to branch master
in repository guix.

The following commit(s) were added to refs/heads/master by this push:
     new f997834  avahi: Remove poll timeout when possible.
f997834 is described below

commit f9978346e73359ac1d8b88c9ed874edc7225582b
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Fri Dec 18 18:10:04 2020 +0100

    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>
---
 guix/avahi.scm | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/guix/avahi.scm b/guix/avahi.scm
index aa90a5c..132e42f 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))))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]