[PATCH 4/4] agent: avoid scheduled checks on socket when inotify is working

Daniel Kahn Gillmor dkg at fifthhorseman.net
Tue Nov 1 06:11:36 CET 2016


* agent/gpg-agent.c (handle_connections): when inotify is working, we
  do not need to schedule a timer to evaluate whether we control our
  own socket or not.

Signed-off-by: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
---
 agent/gpg-agent.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
index 827735c..98fae4f 100644
--- a/agent/gpg-agent.c
+++ b/agent/gpg-agent.c
@@ -2857,6 +2857,8 @@ handle_connections (gnupg_fd_t listen_fd,
 
       /* avoid a fine-grained timer if we don't need one: */
       timertbl[0].interval.tv_sec = need_tick () ? TIMERTICK_INTERVAL : 0;
+      /* avoid waking up to check sockets if we can count on inotify */
+      timertbl[1].interval.tv_sec = (my_inotify_fd == -1) ? CHECK_OWN_SOCKET_INTERVAL : 0;
 
       /* loop through all timers, fire any registered functions, and
          plan next timer to trigger */
-- 
2.10.1




More information about the Gnupg-devel mailing list