summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorSamba Release Account <samba-bugs@samba.org>1997-07-13 14:05:01 +0000
committerSamba Release Account <samba-bugs@samba.org>1997-07-13 14:05:01 +0000
commit136732a6f4cda86b4e28908afb3ad4893439c1ca (patch)
treeb50a0e240ffade7ddb26e570799347c09f5364f6 /source3/smbd
parentadf19b8ec3d3c0e98d9fd4e4f099b50b52695f2d (diff)
downloadsamba-136732a6f4cda86b4e28908afb3ad4893439c1ca.tar.gz
samba-136732a6f4cda86b4e28908afb3ad4893439c1ca.tar.bz2
samba-136732a6f4cda86b4e28908afb3ad4893439c1ca.zip
counter loop % usage only worked if counters were an exact multiple of
SMBD_LOOP time. used >= instead. lkcl (This used to be commit c881dff3bfaa370b5eb4324217796d186572a9e3)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/server.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 528e4769ea..83bb09b11f 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -3886,6 +3886,9 @@ static void process(void)
int deadtime = lp_deadtime()*60;
int counter;
int last_keepalive=0;
+ int service_load_counter = 0;
+ int share_check_counter = 0;
+ int share_clean_counter = 0;
if (deadtime <= 0)
deadtime = DEFAULT_SMBD_TIMEOUT;
@@ -3904,6 +3907,14 @@ static void process(void)
BOOL allidle = True;
extern int keepalive;
+ if (counter > 365 * 3600) /* big number of seconds. */
+ {
+ counter = 0;
+ share_check_counter = 0;
+ share_clean_counter = 0;
+ service_load_counter = 0;
+ }
+
if (smb_read_error == READ_EOF) {
DEBUG(3,("end of file from client\n"));
return;
@@ -3921,17 +3932,31 @@ static void process(void)
unbecome_user();
/* check for smb.conf reload */
- if (!(counter%SMBD_RELOAD_CHECK))
+ if (counter >= service_load_counter + SMBD_RELOAD_CHECK)
+ {
+ service_load_counter = counter;
+
+ /* remove all unused services. reduce some of that memory overhead. */
+ lp_killunused(snum_used);
+
+ /* reload services, if files have changed. */
reload_services(True);
+ }
#if 0 /* JRA */
/* check the share modes every 10 secs */
- if (!(counter%SHARE_MODES_CHECK))
+ if (counter >= share_check_counter + SHARE_MODES_CHECK)
+ {
+ share_check_counter = counter;
check_share_modes();
+ }
/* clean the share modes every 5 minutes */
- if (!(counter%SHARE_MODES_CLEAN))
+ if (counter >= share_clean_counter + SHARE_MODES_CLEAN)
+ {
+ share_clean_counter = counter;
clean_share_modes();
+ }
#endif /* JRA */
/* automatic timeout if all connections are closed */