1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00

counter loop % usage only worked if counters were an exact multiple of

SMBD_LOOP time.  used >= instead.

lkcl
This commit is contained in:
Samba Release Account 0001-01-01 00:00:00 +00:00
parent dcb1a74cf1
commit c881dff3bf

View File

@ -3886,6 +3886,9 @@ static void process(void)
int deadtime = lp_deadtime()*60; int deadtime = lp_deadtime()*60;
int counter; int counter;
int last_keepalive=0; int last_keepalive=0;
int service_load_counter = 0;
int share_check_counter = 0;
int share_clean_counter = 0;
if (deadtime <= 0) if (deadtime <= 0)
deadtime = DEFAULT_SMBD_TIMEOUT; deadtime = DEFAULT_SMBD_TIMEOUT;
@ -3904,6 +3907,14 @@ static void process(void)
BOOL allidle = True; BOOL allidle = True;
extern int keepalive; 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) { if (smb_read_error == READ_EOF) {
DEBUG(3,("end of file from client\n")); DEBUG(3,("end of file from client\n"));
return; return;
@ -3921,17 +3932,31 @@ static void process(void)
unbecome_user(); unbecome_user();
/* check for smb.conf reload */ /* 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); reload_services(True);
}
#if 0 /* JRA */ #if 0 /* JRA */
/* check the share modes every 10 secs */ /* 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(); check_share_modes();
}
/* clean the share modes every 5 minutes */ /* 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(); clean_share_modes();
}
#endif /* JRA */ #endif /* JRA */
/* automatic timeout if all connections are closed */ /* automatic timeout if all connections are closed */