chiark / gitweb /
agent: Avoid scheduled checks on socket when inotify is working.
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Tue, 1 Nov 2016 04:57:44 +0000 (00:57 -0400)
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Tue, 14 Feb 2017 00:29:34 +0000 (00:29 +0000)
* 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@fifthhorseman.net>
Gbp-Pq: Topic gpg-agent-idling
Gbp-Pq: Name 0004-agent-Avoid-scheduled-checks-on-socket-when-inotify-.patch

agent/gpg-agent.c

index b33de7d3947a6a34d2603ad773a7de223df31cd8..56c28a679c2e2b20d35498d9d7569702f7c9a583 100644 (file)
@@ -2907,6 +2907,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 */