summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-12-07 05:48:01 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:16:23 -0500
commit1c6de687f1acdb5c361a620ac206aec7ef166733 (patch)
treeb0e69cae544c8d4971357eac968394fb0020245b
parentb59412e6bfdfbd361ddcb1a653b6189a763e92b2 (diff)
downloadsamba-1c6de687f1acdb5c361a620ac206aec7ef166733.tar.gz
samba-1c6de687f1acdb5c361a620ac206aec7ef166733.tar.bz2
samba-1c6de687f1acdb5c361a620ac206aec7ef166733.zip
r20060: Fix the timout calculation.
Jeremy. (This used to be commit 017be792f3c41aba2cbda10b53d80aad91c5d666)
-rw-r--r--source3/nsswitch/winbindd_cm.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/source3/nsswitch/winbindd_cm.c b/source3/nsswitch/winbindd_cm.c
index b6a6566457..330ba4ca9b 100644
--- a/source3/nsswitch/winbindd_cm.c
+++ b/source3/nsswitch/winbindd_cm.c
@@ -72,16 +72,18 @@ static void set_dc_type_and_flags( struct winbindd_domain *domain );
If we're still offline, exponentially increase the timeout check.
****************************************************************/
-static void calc_new_online_timeout(struct winbindd_domain *domain)
+static void calc_new_online_timeout_check(struct winbindd_domain *domain)
{
+ int wbc = lp_winbind_cache_time();
+
if (domain->startup) {
domain->check_online_timeout = 10;
- } else if (domain->check_online_timeout == 0) {
- domain->check_online_timeout = lp_winbind_cache_time();
+ } else if (domain->check_online_timeout < wbc) {
+ domain->check_online_timeout = wbc;
} else {
- uint32 new_to = (domain->check_online_timeout * domain->check_online_timeout);
- if (new_to < domain->check_online_timeout) {
- new_to = 0x7FFFFFFF;
+ uint32 new_to = domain->check_online_timeout * 3;
+ if (new_to > (3*60*60)) {
+ new_to = 3*60*60; /* 3 hours. */
}
domain->check_online_timeout = new_to;
}
@@ -171,7 +173,7 @@ void set_domain_offline(struct winbindd_domain *domain)
/* If we're in statup mode, check again in 10 seconds, not in
lp_winbind_cache_time() seconds (which is 5 mins by default). */
- calc_new_online_timeout(domain);
+ calc_new_online_timeout_check(domain);
domain->check_online_event = add_timed_event( NULL,
timeval_current_ofs(domain->check_online_timeout,0),