The previous code was strictly correct, but not very practical. self
names were only refreshed every 3 days. I hit a situation where the
Samba WINS server was restarted after deleting wins.dat and didn't
notice some remote subnets (also running Samba). I realised that the
complete database wouldn't have been rebuilt for 3 days, which is way
too long. In order to recover from WINS restarts we need a much
shorter maximum refresh time.
(This used to be commit
1d23dd0912e81ff72695bd043e8e2aee32da18a8)
/* Do all remote announcements this often. */
#define REMOTE_ANNOUNCE_INTERVAL 180
+/* what is the maximum period between name refreshes. Note that this only
+ affects non-permanent self names */
+#define MAX_REFRESH_TIME (60*20)
+
/* Types of machine we can announce as. */
#define ANNOUNCE_AS_NT 1
#define ANNOUNCE_AS_WIN95 2
if( !is_refresh_already_queued( subrec, namerec) )
refresh_name( subrec, namerec, NULL, NULL, NULL );
namerec->data.death_time += lp_max_ttl();
- namerec->data.refresh_time += lp_max_ttl();
+ namerec->data.refresh_time += MIN(lp_max_ttl(), MAX_REFRESH_TIME);
}
}
}
if( namerec->data.death_time != PERMANENT_TTL )
namerec->data.death_time = time_now + ttl;
- namerec->data.refresh_time = time_now + (ttl/2);
+ namerec->data.refresh_time = time_now + MIN((ttl/2), MAX_REFRESH_TIME);
namerec->subnet->namelist_changed = True;
} /* update_name_ttl */
else
namerec->data.death_time = time_now + ttl;
- namerec->data.refresh_time = time_now + (ttl/2);
+ namerec->data.refresh_time = time_now + MIN((ttl/2), MAX_REFRESH_TIME);
/* Now add the record to the name list. */
update_name_in_namelist( subrec, namerec );