chiark / gitweb /
gnupg2 (2.1.17-3) unstable; urgency=medium
[gnupg2.git] / debian / patches / gpg-agent-idling / 0004-agent-Avoid-scheduled-checks-on-socket-when-inotify-.patch
1 From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2 Date: Tue, 1 Nov 2016 00:57:44 -0400
3 Subject: agent: Avoid scheduled checks on socket when inotify is working.
4
5 * agent/gpg-agent.c (handle_connections): When inotify is working, we
6 do not need to schedule a timer to evaluate whether we control our own
7 socket or not.
8
9 Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
10 ---
11  agent/gpg-agent.c | 2 ++
12  1 file changed, 2 insertions(+)
13
14 diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
15 index 1bfe0f3ae..0e5354947 100644
16 --- a/agent/gpg-agent.c
17 +++ b/agent/gpg-agent.c
18 @@ -2894,6 +2894,8 @@ handle_connections (gnupg_fd_t listen_fd,
19  
20        /* avoid a fine-grained timer if we don't need one: */
21        timertbl[0].interval.tv_sec = need_tick () ? TIMERTICK_INTERVAL : 0;
22 +      /* avoid waking up to check sockets if we can count on inotify */
23 +      timertbl[1].interval.tv_sec = (my_inotify_fd == -1) ? CHECK_OWN_SOCKET_INTERVAL : 0;
24  
25        /* loop through all timers, fire any registered functions, and
26           plan next timer to trigger */