From: Daniel Kahn Gillmor Date: Tue, 1 Nov 2016 04:57:44 +0000 (-0400) Subject: agent: Avoid scheduled checks on socket when inotify is working. X-Git-Tag: archive/raspbian/2.2.10-1+rpi1~15 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=6e1b8f8e6bbf731c4a571ca8bd0cfc19f0076959;p=gnupg2.git agent: Avoid scheduled checks on socket when inotify is working. * 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 Gbp-Pq: Topic gpg-agent-idling Gbp-Pq: Name agent-Avoid-scheduled-checks-on-socket-when-inotify-.patch --- diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c index 92b3d0b..5c906d1 100644 --- a/agent/gpg-agent.c +++ b/agent/gpg-agent.c @@ -3036,6 +3036,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 = (sock_inotify_fd == -1) ? CHECK_OWN_SOCKET_INTERVAL : 0; /* loop through all timers, fire any registered functions, and plan next timer to trigger */