guix-commits
[Top][All Lists]
Advanced

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

branch master updated: avahi: Ignore local services.


From: guix-commits
Subject: branch master updated: avahi: Ignore local services.
Date: Thu, 10 Dec 2020 03:48:12 -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 0faef87  avahi: Ignore local services.
0faef87 is described below

commit 0faef871784f4f88e622dd36b492f020387f7a5e
Author: Mathieu Othacehe <othacehe@gnu.org>
AuthorDate: Thu Dec 10 09:46:50 2020 +0100

    avahi: Ignore local services.
    
    * guix/avahi.scm (avahi-browse-service-thread): Add "ignore-local?" argument
    and honor it.
---
 guix/avahi.scm | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/guix/avahi.scm b/guix/avahi.scm
index 8a82fd3..aa90a5c 100644
--- a/guix/avahi.scm
+++ b/guix/avahi.scm
@@ -92,6 +92,7 @@ when STOP-LOOP? procedure returns true."
 (define* (avahi-browse-service-thread proc
                                       #:key
                                       types
+                                      (ignore-local? #t)
                                       (family AF_INET)
                                       (stop-loop? (const #f))
                                       (timeout 100))
@@ -116,7 +117,9 @@ when STOP-LOOP? procedure returns true."
            ;; Add the service if the host is unknown.  This means that if a
            ;; service is available on multiple network interfaces for a single
            ;; host, only the first interface found will be considered.
-           (unless (hash-ref %known-hosts service-name)
+           (unless (or (hash-ref %known-hosts service-name)
+                       (and ignore-local?
+                            (member lookup-result-flag/local flags)))
              (let* ((address (inet-ntop family address))
                     (local-address (interface->ip-address interface))
                     (service* (avahi-service
@@ -144,8 +147,8 @@ when STOP-LOOP? procedure returns true."
      ((eq? event browser-event/remove)
       (let ((service (hash-ref %known-hosts service-name)))
         (when service
-            (proc 'remove-service service)
-            (hash-remove! %known-hosts service-name))))))
+          (proc 'remove-service service)
+          (hash-remove! %known-hosts service-name))))))
 
   (define client-callback
     (lambda (client state)



reply via email to

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