STABLE14-windows-daemon-timers-20051028

the daemon up server check was set for 1 hour and not ten minutes.

turned all interval constants into variables so that they can be
set via registry entries at a future time.


(cherry picked from commit 288886618b347cdd2d4bfaa06a2df18b1a24229e)
This commit is contained in:
Jeffrey Altman 2005-10-29 21:15:07 +00:00
parent 685e2884a6
commit 17e271787c
4 changed files with 25 additions and 14 deletions

View File

@ -132,6 +132,7 @@ FSOBJS=$(OUT)\fs.obj $(OUT)\fs_utils.obj
CMDBGOBJS=$(OUT)\cmdebug.obj
$(CMDBGOBJS): $(AFSROOT)\src\venus\cmdebug.c
$(C2OBJ) -DAFS_PTHREAD_ENV /Fo$@ $**
SLOBJS=$(OUT)\symlink.obj $(OUT)\fs_utils.obj

View File

@ -27,7 +27,12 @@
#include "afsd.h"
#include "afsicf.h"
long cm_daemonCheckInterval = 30;
/* in seconds */
long cm_daemonCheckDownInterval = 180;
long cm_daemonCheckUpInterval = 600;
long cm_daemonCheckVolInterval = 3600;
long cm_daemonCheckCBInterval = 60;
long cm_daemonCheckLockInterval = 60;
long cm_daemonTokenCheckInterval = 180;
osi_rwlock_t cm_daemonLock;
@ -204,11 +209,11 @@ void cm_Daemon(long parm)
srand(ntohl(code));
now = osi_Time();
lastVolCheck = now - 1800 + (rand() % 3600);
lastCBExpirationCheck = now - 60 + (rand() % 60);
lastLockCheck = now - 60 + (rand() % 60);
lastDownServerCheck = now - cm_daemonCheckInterval/2 + (rand() % cm_daemonCheckInterval);
lastUpServerCheck = now - 1800 + (rand() % 3600);
lastVolCheck = now - cm_daemonCheckVolInterval/2 + (rand() % cm_daemonCheckVolInterval);
lastCBExpirationCheck = now - cm_daemonCheckCBInterval/2 + (rand() % cm_daemonCheckCBInterval);
lastLockCheck = now - cm_daemonCheckLockInterval/2 + (rand() % cm_daemonCheckLockInterval);
lastDownServerCheck = now - cm_daemonCheckDownInterval/2 + (rand() % cm_daemonCheckDownInterval);
lastUpServerCheck = now - cm_daemonCheckUpInterval/2 + (rand() % cm_daemonCheckUpInterval);
lastTokenCacheCheck = now - cm_daemonTokenCheckInterval/2 + (rand() % cm_daemonTokenCheckInterval);
while (daemon_ShutdownFlag == 0) {
@ -241,7 +246,7 @@ void cm_Daemon(long parm)
now = osi_Time();
/* check down servers */
if (now > lastDownServerCheck + cm_daemonCheckInterval) {
if (now > lastDownServerCheck + cm_daemonCheckDownInterval) {
lastDownServerCheck = now;
osi_Log0(afsd_logp, "cm_Daemon CheckDownServers");
cm_CheckServers(CM_FLAG_CHECKDOWNSERVERS, NULL);
@ -249,26 +254,26 @@ void cm_Daemon(long parm)
}
/* check up servers */
if (now > lastUpServerCheck + 3600) {
if (now > lastUpServerCheck + cm_daemonCheckUpInterval) {
lastUpServerCheck = now;
osi_Log0(afsd_logp, "cm_Daemon CheckUpServers");
cm_CheckServers(CM_FLAG_CHECKUPSERVERS, NULL);
now = osi_Time();
}
if (now > lastVolCheck + 3600) {
if (now > lastVolCheck + cm_daemonCheckVolInterval) {
lastVolCheck = now;
cm_CheckVolumes();
now = osi_Time();
}
if (now > lastCBExpirationCheck + 60) {
if (now > lastCBExpirationCheck + cm_daemonCheckCBInterval) {
lastCBExpirationCheck = now;
cm_CheckCBExpiration();
now = osi_Time();
}
if (now > lastLockCheck + 60) {
if (now > lastLockCheck + cm_daemonCheckLockInterval) {
lastLockCheck = now;
cm_CheckLocks();
now = osi_Time();

View File

@ -11,7 +11,12 @@
#define __CM_DAEMON_H_ENV_ 1
/* externs */
extern long cm_daemonCheckInterval;
extern long cm_daemonCheckDownInterval;
extern long cm_daemonCheckUpInterval;
extern long cm_daemonCheckVolInterval;
extern long cm_daemonCheckCBInterval;
extern long cm_daemonCheckLockInterval;
extern long cm_daemonTokenCheckInterval;
extern osi_rwlock_t cm_daemonLock;

View File

@ -983,12 +983,12 @@ long cm_IoctlCheckServers(struct smb_ioctl *ioctlp, struct cm_user *userp)
memcpy(&csi, tp, sizeof(csi));
if (csi.tinterval >= 0) {
cp = ioctlp->outDatap;
memcpy(cp, (char *)&cm_daemonCheckInterval, sizeof(long));
memcpy(cp, (char *)&cm_daemonCheckDownInterval, sizeof(long));
ioctlp->outDatap += sizeof(long);
if (csi.tinterval > 0) {
if (!smb_SUser(userp))
return CM_ERROR_NOACCESS;
cm_daemonCheckInterval = csi.tinterval;
cm_daemonCheckDownInterval = csi.tinterval;
}
return 0;
}