#define IDLE_CLOSED_TIMEOUT (60)
#define DPTR_IDLE_TIMEOUT (120)
#define SMBD_SELECT_LOOP (10)
-#define NMBD_SELECT_LOOP (2)
+#define NMBD_SELECT_LOOP (10)
#define BROWSE_INTERVAL (60)
#define REGISTRATION_INTERVAL (10*60)
#define NMBD_INETD_TIMEOUT (120)
void remove_my_servers(void);
void announce_server(struct subnet_record *d, struct work_record *work,
char *name, char *comment, time_t ttl, int server_type);
-void announce_host(void);
-void announce_master(void);
-void announce_remote(void);
+void announce_host(time_t t);
+void announce_master(time_t t);
+void announce_remote(time_t t);
/*The following definitions come from namebrowse.c */
void expire_browse_cache(time_t t);
struct browse_cache_record *add_browser_entry(char *name, int type, char *wg,
time_t ttl, struct in_addr ip, BOOL local);
-void do_browser_lists(void);
+void do_browser_lists(time_t t);
/*The following definitions come from nameconf.c */
BOOL new_only,BOOL wins);
void expire_names(time_t t);
struct name_record *search_for_name(struct subnet_record **d,
- struct nmb_name *question,
+ struct nmb_name *question,
struct in_addr ip, int Time, int search);
/*The following definitions come from namedbresp.c */
struct subnet_record *add_subnet_entry(struct in_addr bcast_ip,
struct in_addr mask_ip,
char *name, BOOL add, BOOL lmhosts);
-void write_browse_list(void);
+void write_browse_list(time_t t);
/*The following definitions come from namedbwork.c */
/*The following definitions come from nameelect.c */
-void check_master_browser(void);
+void check_master_browser(time_t t);
void browser_gone(char *work_name, struct in_addr ip);
void send_election(struct subnet_record *d, char *group,uint32 criterion,
int timeup,char *name);
void become_master(struct subnet_record *d, struct work_record *work);
void become_nonmaster(struct subnet_record *d, struct work_record *work,
int remove_type);
-void run_elections(void);
+void run_elections(time_t t);
void process_election(struct packet_struct *p,char *buf);
BOOL check_elections(void);
/*The following definitions come from nameresp.c */
-void expire_netbios_response_entries();
+void expire_netbios_response_entries(time_t t);
struct response_record *queue_netbios_pkt_wins(struct subnet_record *d,
int fd,int quest_type,enum state_type state,
char *name,int name_type,int nb_flags, time_t ttl,
void add_my_names(void);
void remove_my_names();
void refresh_my_names(time_t t);
-void query_refresh_names(void);
+void query_refresh_names(time_t t);
/*The following definitions come from nameservreply.c */
/****************************************************************************
construct a host announcement unicast
**************************************************************************/
-void announce_host(void)
+void announce_host(time_t t)
{
- time_t t = time(NULL);
struct subnet_record *d;
pstring comment;
char *my_name;
NAME_QUERY_DOM_SRV_CHK command, if there is a response from the
name query initiated here. see response_name_query()
**************************************************************************/
-void announce_master(void)
+void announce_master(time_t t)
{
struct subnet_record *d;
static time_t last=0;
- time_t t = time(NULL);
BOOL am_master = False; /* are we a master of some sort? :-) */
if (!last) last = t;
on a remote browse list. They are done blind, no checking is done to
see if there is actually a browse master at the other end.
**************************************************************************/
-void announce_remote(void)
+void announce_remote(time_t t)
{
char *s,*ptr;
static time_t last_time = 0;
- time_t t = time(NULL);
pstring s2;
struct in_addr addr;
char *comment,*workgroup;
/****************************************************************************
search through browser list for an entry to sync with
**************************************************************************/
-void do_browser_lists(void)
+void do_browser_lists(time_t t)
{
struct browse_cache_record *b;
static time_t last = 0;
- time_t t = time(NULL);
if (t-last < 20) return; /* don't do too many of these at once! */
/* XXXX equally this period should not be too long
/*******************************************************************
write out browse.dat
******************************************************************/
-void write_browse_list(void)
+void write_browse_list(time_t t)
{
struct subnet_record *d;
pstring fname,fnamenew;
FILE *f;
static time_t lasttime = 0;
- time_t t = time(NULL);
if (!lasttime) lasttime = t;
if (!updatedlists || t - lasttime < 5) return;
/*******************************************************************
occasionally check to see if the master browser is around
******************************************************************/
-void check_master_browser(void)
+void check_master_browser(time_t t)
{
static time_t lastrun=0;
- time_t t = time(NULL);
struct subnet_record *d;
if (!lastrun) lastrun = t;
/*******************************************************************
run the election
******************************************************************/
-void run_elections(void)
+void run_elections(time_t t)
{
- time_t t = time(NULL);
static time_t lastime = 0;
struct subnet_record *d;
see name_query() and name_status() for suggested implementation.
******************************************************************/
-void expire_netbios_response_entries()
+void expire_netbios_response_entries(time_t t)
{
struct subnet_record *d;
{
nextn = n->next;
- if (n->repeat_time <= time(NULL))
+ if (n->repeat_time <= t)
{
if (n->repeat_count > 0)
{
for (n = d->namelist; n; n = n->next)
{
/* each SELF name has an individual time to be refreshed */
- if (n->source == SELF && n->refresh_time < time(NULL) &&
+ if (n->source == SELF && n->refresh_time < t &&
n->death_time != 0)
{
add_my_name_entry(d,n->name.name,n->name.name_type,
XXXX which names to poll and which not can be refined at a later date.
******************************************************************/
-void query_refresh_names(void)
+void query_refresh_names(time_t t)
{
struct name_record *n;
struct subnet_record *d = find_subnet(ipgrp);
static time_t lasttime = 0;
- time_t t = time(NULL);
int count = 0;
int name_refresh_time = NAME_POLL_REFRESH_TIME;
/*******************************************************************
expire old names from the namelist and server list
******************************************************************/
-static void expire_names_and_servers(void)
+static void expire_names_and_servers(time_t t)
{
static time_t lastrun = 0;
- time_t t = time(NULL);
if (!lastrun) lastrun = t;
if (t < lastrun + 5) return;
listen_for_packets(run_election);
run_packet_queue();
- run_elections();
+ run_elections(t);
- announce_host();
+ announce_host(t);
- announce_master();
+ announce_master(t);
- announce_remote();
+ announce_remote(t);
- query_refresh_names();
+ query_refresh_names(t);
- expire_names_and_servers();
- expire_netbios_response_entries();
+ expire_names_and_servers(t);
+ expire_netbios_response_entries(t);
refresh_my_names(t);
- write_browse_list();
- do_browser_lists();
- check_master_browser();
+ write_browse_list(t);
+ do_browser_lists(t);
+ check_master_browser(t);
}
}
DEBUG(3,("Loaded names\n"));
- write_browse_list();
+ write_browse_list(time(NULL));
DEBUG(3,("Dumped names\n"));