small cosmetic changes in spacing.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@24214 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Dave Wetzel 2006-12-19 12:16:57 +00:00
parent 2f2a13fc47
commit 126006dd58

View file

@ -71,7 +71,7 @@ GSWLoadBalancing_FindApp(GSWAppRequest *p_pAppRequest,
GSWAppInstance *pAppInstance=NULL; GSWAppInstance *pAppInstance=NULL;
time_t curTime = (time_t)0; time_t curTime = (time_t)0;
while (!fFound && iTries-->0) while (!fFound && ((iTries--) > 0))
{ {
pApp->iLastInstanceIndex = (pApp->iLastInstanceIndex+1) % uInstancesCount; pApp->iLastInstanceIndex = (pApp->iLastInstanceIndex+1) % uInstancesCount;
GSWDebugLog(p_pLogServerData,"LoadBalancing: Will try instance %d (instances count=%d).", GSWDebugLog(p_pLogServerData,"LoadBalancing: Will try instance %d (instances count=%d).",
@ -103,6 +103,7 @@ GSWLoadBalancing_FindApp(GSWAppRequest *p_pAppRequest,
pAppInstance->timeNextRetryTime=0; pAppInstance->timeNextRetryTime=0;
}; };
}; };
if (pAppInstance->timeNextRetryTime==0 && pAppInstance->fValid) if (pAppInstance->timeNextRetryTime==0 && pAppInstance->fValid)
{ {
BOOL okay = TRUE; BOOL okay = TRUE;
@ -140,11 +141,11 @@ GSWLoadBalancing_FindApp(GSWAppRequest *p_pAppRequest,
p_pAppRequest->pAppInstance = pAppInstance; p_pAppRequest->pAppInstance = pAppInstance;
pAppInstance->uOpenedRequestsNb++; pAppInstance->uOpenedRequestsNb++;
} }
}; }
}; }
}; }
GSWList_Free(pInstancesList,FALSE); GSWList_Free(pInstancesList,FALSE);
}; }
GSWLock_Unlock(g_lockAppList); GSWLock_Unlock(g_lockAppList);
if (fFound) if (fFound)
@ -182,11 +183,12 @@ GSWLoadBalancing_FindInstance(GSWAppRequest *p_pAppRequest,
pApp = (GSWApp *)GSWConfig_GetApp(p_pAppRequest->pszName); pApp = (GSWApp *)GSWConfig_GetApp(p_pAppRequest->pszName);
if (pApp) if (pApp)
{ {
GSWAppInstance *pAppInstance=NULL; GSWAppInstance *pAppInstance = NULL;
char szInstanceNum[50]=""; char szInstanceNum[50] = "";
sprintf(szInstanceNum,"%d",p_pAppRequest->iInstance); sprintf(szInstanceNum,"%d",p_pAppRequest->iInstance);
pAppInstance =
(GSWAppInstance *)GSWDict_ValueForKey(&pApp->stInstancesDict, pAppInstance = (GSWAppInstance *)GSWDict_ValueForKey(&pApp->stInstancesDict,
szInstanceNum); szInstanceNum);
// Not a known instance // Not a known instance
@ -197,25 +199,25 @@ GSWLoadBalancing_FindInstance(GSWAppRequest *p_pAppRequest,
fFound=GSWLoadBalancing_FindApp(p_pAppRequest, fFound=GSWLoadBalancing_FindApp(p_pAppRequest,
p_pLogServerData, p_pLogServerData,
p_pURLComponents); p_pURLComponents);
} } else {
else
{
GSWDebugLog(p_pLogServerData,"Instance Found"); GSWDebugLog(p_pLogServerData,"Instance Found");
if (pAppInstance->fValid) if (pAppInstance->fValid)
{ {
BOOL okay = TRUE; BOOL okay = TRUE;
// check if refused, time to try again ? // check if refused, time to try again ?
if (p_pURLComponents->stRequestHandlerKey.iLength==0 || if (p_pURLComponents->stRequestHandlerKey.iLength==0 || p_pURLComponents->stRequestHandlerKey.pszStart==NULL)
p_pURLComponents->stRequestHandlerKey.pszStart==NULL)
{ {
GSWAppInfo *thisAppInfo = GSWAppInfo *thisAppInfo =
GSWAppInfo_Find(p_pAppRequest->pszName, GSWAppInfo_Find(p_pAppRequest->pszName,
pAppInstance->iInstance); pAppInstance->iInstance);
if (thisAppInfo && thisAppInfo->isRefused) if (thisAppInfo && thisAppInfo->isRefused)
{ {
time_t actTime = (time_t)0; time_t actTime = (time_t)0;
// this instance refuses new sessions // this instance refuses new sessions
time(&actTime); time(&actTime);
if (actTime > thisAppInfo->timeNextRetryTime) if (actTime > thisAppInfo->timeNextRetryTime)
{ {
thisAppInfo->isRefused = FALSE; // try it again thisAppInfo->isRefused = FALSE; // try it again
@ -238,20 +240,18 @@ GSWLoadBalancing_FindInstance(GSWAppRequest *p_pAppRequest,
pAppInstance->uOpenedRequestsNb++; pAppInstance->uOpenedRequestsNb++;
GSWDebugLog(p_pLogServerData,"Instance is valid"); GSWDebugLog(p_pLogServerData,"Instance is valid");
} }
} } else {
else
{
GSWDebugLog(p_pLogServerData,"Instance is not valid"); GSWDebugLog(p_pLogServerData,"Instance is not valid");
}; }
}; }
}; }
GSWLock_Unlock(g_lockAppList); GSWLock_Unlock(g_lockAppList);
GSWDebugLog(p_pLogServerData,"Stop GSWLoadBalancing_FindInstance"); GSWDebugLog(p_pLogServerData,"Stop GSWLoadBalancing_FindInstance");
return fFound; return fFound;
}; }
//-------------------------------------------------------------------- //--------------------------------------------------------------------
void void