Page MenuHome GnuPG

904_0137-agent-Create-framework-of-scheduled-timers.patch
Needs ReviewPublic

Authored by dkg on Nov 15 2016, 12:58 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Date: Mon, 31 Oct 2016 21:27:36 -0400
Subject: agent: Create framework of scheduled timers.

agent/gpg-agent.c (handle_tick): Remove intermittent call to
check_own_socket.
(tv_is_set): Add inline helper function for readability.
(handle_connections) Create general table of pending scheduled
timeouts.

handle_tick() does fine-grained, rapid activity. check_own_socket()
is supposed to happen at a different interval.

Mixing the two of them makes it a requirement that one interval be a
multiple of the other, which isn't ideal if there are different delay
strategies that we might want in the future.

Creating an extensible regular timer framework in handle_connections
should make it possible to have any number of cadenced timers fire
regularly, without requiring that they happen in cadences related to
each other.

It should also make it possible to dynamically change the cadence of
any regularly-scheduled timeout.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>

agent/gpg-agent.c | 87 ++++++++++++++++++++++++++++++++++++-------------------
1 file changed, 58 insertions(+), 29 deletions(-)

Test Plan

Diff Detail

Lint
Lint Skipped
Unit
Unit Tests Skipped