1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

Make dirmngr more battery friendly.

Similar to gpg-agent, dirmngr's wait timeouts are now synced to the
full second.  Increased ldap helper thread timeout to 2 seconds.

Nuked some white spaces.
This commit is contained in:
Werner Koch 2011-01-25 11:26:01 +01:00
parent 62842cc7fe
commit 2b81258b2b
4 changed files with 198 additions and 123 deletions

View file

@ -269,8 +269,17 @@ ldap_wrapper_thread (void *dummy)
{
pth_event_t timeout_ev;
int any_action = 0;
pth_time_t nexttick;
timeout_ev = pth_event (PTH_EVENT_TIME, pth_timeout (1, 0));
/* We timeout the pth_wait every 2 seconds. To help with power
saving we syncronize the timeouts to the next full second. */
nexttick = pth_timeout (2, 0);
if (nexttick.tv_usec > 10) /* Use a 10 usec threshhold. */
{
nexttick.tv_sec++;
nexttick.tv_usec = 0;
}
timeout_ev = pth_event (PTH_EVENT_TIME, nexttick);
if (! timeout_ev)
{
log_error (_("pth_event failed: %s\n"), strerror (errno));