‘guix discover’ polls

  • Done
  • quality assurance status badge
Details
2 participants
  • Ludovic Courtès
  • Mathieu Othacehe
Owner
unassigned
Submitted by
Ludovic Courtès
Severity
normal
L
L
Ludovic Courtès wrote on 18 Dec 2020 18:10
‘guix discover’ polls
(address . bug-guix@gnu.org)
87a6ub9h1v.fsf@inria.fr
Hi!

‘guix discover’ polls with 100ms intervals:

Toggle snippet (17 lines)
18:00:57 poll([{fd=14, events=POLLIN}, {fd=16, events=POLLIN}], 2, 100) = 0 (Timeout)
18:00:57 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
18:00:57 poll([{fd=14, events=POLLIN}, {fd=16, events=POLLIN}], 2, 100) = 0 (Timeout)
18:00:57 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
18:00:57 poll([{fd=14, events=POLLIN}, {fd=16, events=POLLIN}], 2, 100) = 0 (Timeout)
18:00:57 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
18:00:57 poll([{fd=14, events=POLLIN}, {fd=16, events=POLLIN}], 2, 100) = 0 (Timeout)
18:00:57 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
18:00:57 poll([{fd=14, events=POLLIN}, {fd=16, events=POLLIN}], 2, 100) = 0 (Timeout)
18:00:57 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
18:00:57 poll([{fd=14, events=POLLIN}, {fd=16, events=POLLIN}], 2, 100) = 0 (Timeout)
18:00:57 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
18:00:57 poll([{fd=14, events=POLLIN}, {fd=16, events=POLLIN}], 2, 100) = 0 (Timeout)
18:00:58 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
18:00:58 poll([{fd=14, events=POLLIN}, {fd=16, events=POLLIN}], 2, 100) = 0 (Timeout)

This comes from ‘avahi-browse-service-thread’ in (guix avahi) and its
100ms #:timeout.

How about the change below?

Thanks,
Ludo’.
Toggle diff (34 lines)
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))))))
M
M
Mathieu Othacehe wrote on 20 Dec 2020 10:43
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 45314-done@debbugs.gnu.org)
87czz4g6e3.fsf@gnu.org
Hey Ludo,

Toggle quote (2 lines)
> How about the change below?

I think it looks nice! I pushed it as
f9978346e73359ac1d8b88c9ed874edc7225582b.

Thanks,

Mathieu
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 45314@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 45314
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch