mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
avahi: Ignore local services.
* guix/avahi.scm (avahi-browse-service-thread): Add "ignore-local?" argument and honor it.
This commit is contained in:
parent
71dd1be597
commit
0faef87178
1 changed files with 6 additions and 3 deletions
|
@ -92,6 +92,7 @@ (define (interface->ip-address interface)
|
|||
(define* (avahi-browse-service-thread proc
|
||||
#:key
|
||||
types
|
||||
(ignore-local? #t)
|
||||
(family AF_INET)
|
||||
(stop-loop? (const #f))
|
||||
(timeout 100))
|
||||
|
@ -116,7 +117,9 @@ (define (service-resolver-callback resolver interface protocol event
|
|||
;; 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 @@ (define (service-browser-callback browser interface protocol event
|
|||
((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)
|
||||
|
|
Loading…
Reference in a new issue