summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/include/local.h2
-rw-r--r--source3/include/proto.h20
-rw-r--r--source3/nameannounce.c9
-rw-r--r--source3/namebrowse.c3
-rw-r--r--source3/namedbsubnet.c3
-rw-r--r--source3/nameelect.c6
-rw-r--r--source3/nameresp.c4
-rw-r--r--source3/nameserv.c5
-rw-r--r--source3/nmbd/nmbd.c25
9 files changed, 34 insertions, 43 deletions
diff --git a/source3/include/local.h b/source3/include/local.h
index 115617094c..465e0029b6 100644
--- a/source3/include/local.h
+++ b/source3/include/local.h
@@ -119,7 +119,7 @@
#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)
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 8c082a6140..2c6047954e 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -306,16 +306,16 @@ void do_announce_host(int command,
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 */
@@ -354,7 +354,7 @@ struct name_record *add_netbios_entry(struct subnet_record *d,
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 */
@@ -393,7 +393,7 @@ void add_my_subnets(char *group);
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 */
@@ -406,7 +406,7 @@ void dump_workgroups(void);
/*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);
@@ -416,7 +416,7 @@ void name_register_work(struct subnet_record *d, char *name, int name_type,
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);
@@ -453,7 +453,7 @@ BOOL name_query(int fd,char *name,int name_type,
/*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,
@@ -474,7 +474,7 @@ void add_my_name_entry(struct subnet_record *d,char *name,int type,int nb_flags)
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 */
diff --git a/source3/nameannounce.c b/source3/nameannounce.c
index fec8895510..1dadc0132c 100644
--- a/source3/nameannounce.c
+++ b/source3/nameannounce.c
@@ -292,9 +292,8 @@ void announce_server(struct subnet_record *d, struct work_record *work,
/****************************************************************************
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;
@@ -368,11 +367,10 @@ void announce_host(void)
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;
@@ -477,11 +475,10 @@ void announce_master(void)
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;
diff --git a/source3/namebrowse.c b/source3/namebrowse.c
index b426bc7a15..3bc4f9f82a 100644
--- a/source3/namebrowse.c
+++ b/source3/namebrowse.c
@@ -190,11 +190,10 @@ static void start_sync_browse_entry(struct browse_cache_record *b)
/****************************************************************************
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
diff --git a/source3/namedbsubnet.c b/source3/namedbsubnet.c
index 0bad79246a..16eeb6322e 100644
--- a/source3/namedbsubnet.c
+++ b/source3/namedbsubnet.c
@@ -252,14 +252,13 @@ struct subnet_record *add_subnet_entry(struct in_addr bcast_ip,
/*******************************************************************
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;
diff --git a/source3/nameelect.c b/source3/nameelect.c
index be8a405daa..1c4f8e6390 100644
--- a/source3/nameelect.c
+++ b/source3/nameelect.c
@@ -54,10 +54,9 @@ extern uint16 nb_type; /* samba's NetBIOS name type */
/*******************************************************************
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;
@@ -474,9 +473,8 @@ void become_nonmaster(struct subnet_record *d, struct work_record *work,
/*******************************************************************
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;
diff --git a/source3/nameresp.c b/source3/nameresp.c
index 7fcb41e79f..2a8c5e88b0 100644
--- a/source3/nameresp.c
+++ b/source3/nameresp.c
@@ -174,7 +174,7 @@ static void dead_netbios_entry(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;
@@ -186,7 +186,7 @@ void expire_netbios_response_entries()
{
nextn = n->next;
- if (n->repeat_time <= time(NULL))
+ if (n->repeat_time <= t)
{
if (n->repeat_count > 0)
{
diff --git a/source3/nameserv.c b/source3/nameserv.c
index c8bbb52811..7353251940 100644
--- a/source3/nameserv.c
+++ b/source3/nameserv.c
@@ -240,7 +240,7 @@ void refresh_my_names(time_t t)
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,
@@ -263,13 +263,12 @@ void refresh_my_names(time_t t)
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;
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index 5b3fd19491..d8865662c7 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -159,10 +159,9 @@ static void fault_continue(void)
/*******************************************************************
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;
@@ -298,23 +297,23 @@ static void process(void)
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);
}
}
@@ -528,7 +527,7 @@ static void usage(char *pname)
DEBUG(3,("Loaded names\n"));
- write_browse_list();
+ write_browse_list(time(NULL));
DEBUG(3,("Dumped names\n"));