diff options
author | Werner Koch <[email protected]> | 2011-01-25 10:26:01 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2011-01-25 10:26:01 +0000 |
commit | 2b81258b2bf80e4819904028c3ac5fddcec2a8e9 (patch) | |
tree | 1a722726092cf952b5167bad25da6b44839b5cc4 /dirmngr/ldap-wrapper.c | |
parent | Remove keyserver/ from the build system. (diff) | |
download | gnupg-2b81258b2bf80e4819904028c3ac5fddcec2a8e9.tar.gz gnupg-2b81258b2bf80e4819904028c3ac5fddcec2a8e9.zip |
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.
Diffstat (limited to 'dirmngr/ldap-wrapper.c')
-rw-r--r-- | dirmngr/ldap-wrapper.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/dirmngr/ldap-wrapper.c b/dirmngr/ldap-wrapper.c index 25ec15513..fa5bf3c6b 100644 --- a/dirmngr/ldap-wrapper.c +++ b/dirmngr/ldap-wrapper.c @@ -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)); |