mirror of
https://github.com/gnustep/libs-gsweb.git
synced 2025-02-22 03:01:27 +00:00
2003-04-09 Manuel Guesdon <mguesdon@orange-concept.com>
* GSWAdaptors/common/GSWUtils.c: o prefix logs with GSWeb[pid] * GSWAdaptors/common/GSWAppRequest.c: o improved logs * GSWApp.c/.h: o add instance handled request count and no response count * GSWConfig.c: o remove "GSWeb:" prefix in logs o initialize * GSWApp.h: o renamed instance index * GSWLoadBalancing.c: o logs git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@16407 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
5c4755be70
commit
bf181167d1
8 changed files with 205 additions and 126 deletions
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
|||
2003-04-09 Manuel Guesdon <mguesdon@orange-concept.com>
|
||||
* GSWAdaptors/common/GSWUtils.c:
|
||||
o prefix logs with GSWeb[pid]
|
||||
* GSWAdaptors/common/GSWAppRequest.c:
|
||||
o improved logs
|
||||
* GSWApp.c/.h:
|
||||
o add instance handled request count and no response count
|
||||
* GSWConfig.c:
|
||||
o remove "GSWeb:" prefix in logs
|
||||
o initialize
|
||||
* GSWApp.h:
|
||||
o renamed instance index
|
||||
* GSWLoadBalancing.c:
|
||||
o logs
|
||||
|
||||
2003-04-09 Manuel Guesdon <mguesdon@orange-concept.com>
|
||||
* GSWeb.framework/GSWSessionTimeOut.m:
|
||||
o fix in -description
|
||||
|
|
|
@ -137,12 +137,13 @@ GSWeb_GetServerConfig(server_rec *p_pServerRec)
|
|||
static int GSWeb_PostConfig(apr_pool_t *p, apr_pool_t *plog,
|
||||
apr_pool_t *ptemp, server_rec *s)
|
||||
{
|
||||
ap_add_version_component(p,
|
||||
"mod_gsweb/"
|
||||
GSWEB_SERVER_ADAPTOR_VERSION_MAJOR_STRING
|
||||
"." GSWEB_SERVER_ADAPTOR_VERSION_MINOR_STRING
|
||||
"-" moduleRevision);
|
||||
return OK;
|
||||
char buffer[256]="mod_gsweb/"
|
||||
GSWEB_SERVER_ADAPTOR_VERSION_MAJOR_STRING
|
||||
"." GSWEB_SERVER_ADAPTOR_VERSION_MINOR_STRING
|
||||
"rev";
|
||||
RevisionStringToRevisionValue(buffer+strlen(buffer),moduleRevision);
|
||||
ap_add_version_component(p, buffer);
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
//--------------------------------------------------------------------
|
||||
|
|
|
@ -28,12 +28,12 @@ typedef struct _GSWApp
|
|||
{
|
||||
int iUsageCounter;
|
||||
char *pszName;
|
||||
int iIndex;//Current Instance Index
|
||||
GSWDict stInstancesDict;
|
||||
GSWDict stHeadersDict;
|
||||
char *pszGSWExtensionsFrameworkWebServerResources;
|
||||
BOOL fCanDump;
|
||||
char *pszAdaptorTemplatesPath;
|
||||
int iLastInstanceIndex;//Last Instance Index
|
||||
} GSWApp;
|
||||
|
||||
typedef struct _GSWAppInstance
|
||||
|
@ -44,6 +44,8 @@ typedef struct _GSWAppInstance
|
|||
int iPort;
|
||||
time_t timeNextRetryTime; // Timer
|
||||
unsigned int uOpenedRequestsNb;
|
||||
unsigned int uHandledRequestsNb;
|
||||
unsigned int uNotRespondingRequestsNb;
|
||||
BOOL fValid;
|
||||
} GSWAppInstance;
|
||||
|
||||
|
|
|
@ -96,112 +96,118 @@ GSWAppRequest_SendAppRequestToApp(GSWHTTPRequest **p_ppHTTPRequest,
|
|||
while (!pHTTPResponse && fAppFound && iAttemptsRemaining-->0)
|
||||
{
|
||||
fAppNotResponding=FALSE;
|
||||
GSWLog(GSW_INFO,p_pLogServerData,"Trying to contact %s:%d on %s(%d)",
|
||||
GSWLog(GSW_INFO,p_pLogServerData,"Attempt# %d: Trying to contact %s:%d on %s(%d)",
|
||||
(int)(APP_CONNECT_RETRIES_NB-iAttemptsRemaining),
|
||||
p_pAppRequest->pszName,
|
||||
p_pAppRequest->iInstance,
|
||||
p_pAppRequest->pszHost,
|
||||
p_pAppRequest->iPort);
|
||||
|
||||
hConnect = GSWApp_Open(p_pAppRequest,p_pLogServerData);
|
||||
if (hConnect)
|
||||
{
|
||||
if (p_pAppRequest->eType==EAppType_LoadBalanced)
|
||||
GSWLoadBalancing_StartAppRequest(p_pAppRequest,
|
||||
p_pLogServerData);
|
||||
|
||||
GSWLog(GSW_INFO,p_pLogServerData,"%s:%d on %s(%d) connected",
|
||||
p_pAppRequest->pszName,
|
||||
p_pAppRequest->iInstance,
|
||||
p_pAppRequest->pszHost,
|
||||
p_pAppRequest->iPort);
|
||||
|
||||
GSWHTTPRequest_HTTPToAppRequest(*p_ppHTTPRequest,
|
||||
p_pAppRequest,
|
||||
if (hConnect)
|
||||
{
|
||||
if (p_pAppRequest->eType==EAppType_LoadBalanced)
|
||||
GSWLoadBalancing_StartAppRequest(p_pAppRequest,
|
||||
p_pLogServerData);
|
||||
|
||||
GSWLog(GSW_INFO,p_pLogServerData,"%s:%d on %s(%d) connected",
|
||||
p_pAppRequest->pszName,
|
||||
p_pAppRequest->iInstance,
|
||||
p_pAppRequest->pszHost,
|
||||
p_pAppRequest->iPort);
|
||||
|
||||
GSWHTTPRequest_HTTPToAppRequest(*p_ppHTTPRequest,
|
||||
p_pAppRequest,
|
||||
p_pURLComponents,
|
||||
p_pszHTTPVersion,
|
||||
p_pLogServerData);
|
||||
if (GSWHTTPRequest_SendRequest(*p_ppHTTPRequest,
|
||||
hConnect,
|
||||
p_pLogServerData) != 0)
|
||||
{
|
||||
GSWLog(GSW_ERROR,p_pLogServerData,"Failed to send request");
|
||||
GSWApp_Close(hConnect,p_pLogServerData);
|
||||
hConnect=NULL;
|
||||
fAppNotResponding=TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
GSWLog(GSW_INFO,p_pLogServerData,
|
||||
"Request %s sent, awaiting response",
|
||||
(*p_ppHTTPRequest)->pszRequest);
|
||||
|
||||
appName = strdup(p_pAppRequest->pszName);
|
||||
appInstance = p_pAppRequest->iInstance;
|
||||
|
||||
p_pAppRequest->pRequest = NULL;
|
||||
pHTTPResponse = GSWHTTPResponse_GetResponse(hConnect,
|
||||
p_pLogServerData);
|
||||
p_pAppRequest->pResponse = pHTTPResponse;
|
||||
|
||||
if (p_pAppRequest->eType == EAppType_LoadBalanced)
|
||||
GSWLoadBalancing_StopAppRequest(p_pAppRequest,
|
||||
p_pLogServerData);
|
||||
|
||||
GSWApp_Close(hConnect,p_pLogServerData);
|
||||
hConnect=NULL;
|
||||
|
||||
glbResponsesNb++;
|
||||
if (pHTTPResponse)
|
||||
{
|
||||
char *value =
|
||||
GSWDict_ValueForKey(pHTTPResponse->pHeaders,
|
||||
"x-gsweb-refusing-redirection");
|
||||
if (value && (strncmp(value,"YES",3)==0))
|
||||
p_pszHTTPVersion,
|
||||
p_pLogServerData);
|
||||
if (GSWHTTPRequest_SendRequest(*p_ppHTTPRequest,
|
||||
hConnect,
|
||||
p_pLogServerData) != 0)
|
||||
{
|
||||
GSWLog(GSW_ERROR,p_pLogServerData,"Failed to send request to application %s:%d on %s(%d)",
|
||||
p_pAppRequest->pszName,
|
||||
p_pAppRequest->iInstance,
|
||||
p_pAppRequest->pszHost,
|
||||
p_pAppRequest->iPort);
|
||||
|
||||
GSWApp_Close(hConnect,p_pLogServerData);
|
||||
hConnect=NULL;
|
||||
fAppNotResponding=TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
GSWLog(GSW_INFO,p_pLogServerData,
|
||||
"Request %s sent, awaiting response",
|
||||
(*p_ppHTTPRequest)->pszRequest);
|
||||
|
||||
appName = strdup(p_pAppRequest->pszName);
|
||||
appInstance = p_pAppRequest->iInstance;
|
||||
|
||||
p_pAppRequest->pRequest = NULL;
|
||||
pHTTPResponse = GSWHTTPResponse_GetResponse(hConnect,
|
||||
p_pLogServerData);
|
||||
p_pAppRequest->pResponse = pHTTPResponse;
|
||||
|
||||
if (p_pAppRequest->eType == EAppType_LoadBalanced)
|
||||
GSWLoadBalancing_StopAppRequest(p_pAppRequest,
|
||||
p_pLogServerData);
|
||||
|
||||
GSWApp_Close(hConnect,p_pLogServerData);
|
||||
hConnect=NULL;
|
||||
|
||||
glbResponsesNb++;
|
||||
if (pHTTPResponse)
|
||||
{
|
||||
char *value =
|
||||
GSWDict_ValueForKey(pHTTPResponse->pHeaders,
|
||||
"x-gsweb-refusing-redirection");
|
||||
if (value && (strncmp(value,"YES",3)==0))
|
||||
{
|
||||
// refuseNewSessions == YES in app
|
||||
GSWLog(GSW_INFO,p_pLogServerData,
|
||||
"### This app (%s / %d) is refusing all new sessions ###",
|
||||
"### This app (%s / %d) is refusing all new sessions ###",
|
||||
appName, appInstance);
|
||||
GSWAppInfo_Set(appName, appInstance, TRUE);
|
||||
}
|
||||
|
||||
GSWLog(GSW_INFO,p_pLogServerData,
|
||||
"received: %d %s",
|
||||
pHTTPResponse->uStatus,
|
||||
pHTTPResponse->pszStatusMessage);
|
||||
};
|
||||
if (appName)
|
||||
{
|
||||
free(appName);
|
||||
appName = NULL;
|
||||
}
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
fAppNotResponding=TRUE;
|
||||
GSWLog(GSW_WARNING,p_pLogServerData,
|
||||
"%s:%d NOT LISTENING on %s:%d",
|
||||
p_pAppRequest->pszName,
|
||||
p_pAppRequest->iInstance,
|
||||
p_pAppRequest->pszHost,
|
||||
p_pAppRequest->iPort);
|
||||
//TODO
|
||||
/*
|
||||
if (p_pAppRequest->eType == EAppType_Auto)
|
||||
GSWLoadBalancing_MarkNotRespondingApp(p_pAppRequest,
|
||||
p_pLogServerData);
|
||||
|
||||
GSWLog(GSW_INFO,p_pLogServerData,
|
||||
"received: %d %s",
|
||||
pHTTPResponse->uStatus,
|
||||
pHTTPResponse->pszStatusMessage);
|
||||
};
|
||||
if (appName)
|
||||
{
|
||||
free(appName);
|
||||
appName = NULL;
|
||||
}
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
fAppNotResponding=TRUE;
|
||||
GSWLog(GSW_WARNING,p_pLogServerData,
|
||||
"%s:%d NOT LISTENING on %s:%d",
|
||||
p_pAppRequest->pszName,
|
||||
p_pAppRequest->iInstance,
|
||||
p_pAppRequest->pszHost,
|
||||
p_pAppRequest->iPort);
|
||||
//TODO
|
||||
/*
|
||||
if (p_pAppRequest->eType == EAppType_Auto)
|
||||
GSWLoadBalancing_MarkNotRespondingApp(p_pAppRequest,
|
||||
p_pLogServerData);
|
||||
|
||||
else*/ if (p_pAppRequest->eType==EAppType_LoadBalanced)
|
||||
{
|
||||
GSWLoadBalancing_MarkNotRespondingApp(p_pAppRequest,
|
||||
p_pLogServerData);
|
||||
if (iAttemptsRemaining-->0)
|
||||
fAppFound=GSWLoadBalancing_FindApp(p_pAppRequest,
|
||||
p_pLogServerData,
|
||||
p_pURLComponents);
|
||||
};
|
||||
};
|
||||
else*/ if (p_pAppRequest->eType==EAppType_LoadBalanced)
|
||||
{
|
||||
GSWLoadBalancing_MarkNotRespondingApp(p_pAppRequest,
|
||||
p_pLogServerData);
|
||||
if (iAttemptsRemaining-->0)
|
||||
fAppFound=GSWLoadBalancing_FindApp(p_pAppRequest,
|
||||
p_pLogServerData,
|
||||
p_pURLComponents);
|
||||
};
|
||||
};
|
||||
};
|
||||
if (fAppNotResponding)
|
||||
{
|
||||
|
@ -236,6 +242,7 @@ GSWAppRequest_SendAppRequestToApp(GSWHTTPRequest **p_ppHTTPRequest,
|
|||
};
|
||||
GSWHTTPRequest_Free(*p_ppHTTPRequest,p_pLogServerData);
|
||||
*p_ppHTTPRequest=NULL;
|
||||
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,"Stop GSWAppRequest_SendAppRequestToApp");
|
||||
return pHTTPResponse;
|
||||
};
|
||||
|
@ -301,17 +308,25 @@ GSWAppRequest_HandleRequest(GSWHTTPRequest **p_ppHTTPRequest,
|
|||
GSWLog(GSW_DEBUG,p_pLogServerData,"Get Request Instance Number");
|
||||
|
||||
// in URL ?
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,
|
||||
"Cookie %s",
|
||||
p_pURLComponents->stAppNumber);
|
||||
if (p_pURLComponents->stAppNumber.iLength>0 &&
|
||||
p_pURLComponents->stAppNumber.pszStart)
|
||||
stAppRequest.iInstance =
|
||||
atoi(p_pURLComponents->stAppNumber.pszStart);
|
||||
|
||||
{
|
||||
stAppRequest.iInstance =
|
||||
atoi(p_pURLComponents->stAppNumber.pszStart);
|
||||
}
|
||||
// In Cookie ?
|
||||
else
|
||||
{
|
||||
CONST char *pszCookie=
|
||||
GSWHTTPRequest_HeaderForKey(*p_ppHTTPRequest,
|
||||
g_szHeader_Cookie);
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,
|
||||
"Cookie Instance %s: %s",
|
||||
g_szHeader_Cookie,
|
||||
pszCookie);
|
||||
if (pszCookie)
|
||||
{
|
||||
CONST char *pszInstanceCookie =
|
||||
|
|
|
@ -122,7 +122,7 @@ GSWConfig_Init(GSWDict *p_pDict,
|
|||
GSWConfig_SetConfigFilePath(pszPath);
|
||||
};
|
||||
GSWLog(GSW_INFO,p_pLogServerData,
|
||||
"GSWeb: GSWConfig_Init: %s %s path: %s",
|
||||
"GSWConfig_Init: %s %s path: %s",
|
||||
g_szServerStringInfo,g_szAdaptorStringInfo,pszPath);
|
||||
GSWLock_Init(g_lockAppList);
|
||||
};
|
||||
|
@ -165,7 +165,7 @@ GSWConfig_SetConfigFilePath(CONST char *p_pszConfigFilePath)
|
|||
else
|
||||
{
|
||||
GSWLog(GSW_CRITICAL,NULL,
|
||||
"GSWeb: No path for config file. Add a %s directive in your web server configuration",
|
||||
"No path for config file. Add a %s directive in your web server configuration",
|
||||
g_szGSWeb_Conf_ConfigFilePath);
|
||||
};
|
||||
};
|
||||
|
@ -234,11 +234,12 @@ GSWConfig_ReadIFND(CONST char *p_pszConfigPath,
|
|||
EGSWConfigResult eResult=EGSWConfigResult__Ok;
|
||||
p_pLogServerData=NULL;//General Log
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,
|
||||
"GSWeb: GSWConfig_ReadIFND: %s",
|
||||
"GSWConfig_ReadIFND: %s",
|
||||
p_pszConfigPath);
|
||||
|
||||
if (!p_pszConfigPath)
|
||||
{
|
||||
GSWLog(GSW_CRITICAL,p_pLogServerData,"GSWeb: No path for config file.");
|
||||
GSWLog(GSW_CRITICAL,p_pLogServerData,"No path for config file.");
|
||||
eResult=EGSWConfigResult__Error;
|
||||
}
|
||||
else
|
||||
|
@ -250,7 +251,7 @@ GSWConfig_ReadIFND(CONST char *p_pszConfigPath,
|
|||
if (timeNow-timePrevious<CONFIG_FILE_STAT_INTERVAL)
|
||||
{
|
||||
GSWLog(GSW_INFO,p_pLogServerData,
|
||||
"GSWeb: GSWConfig_ReadIFND: Not Reading : Less than %d sec since last read config file.",
|
||||
"GSWConfig_ReadIFND: Not Reading : Less than %d sec since last read config file.",
|
||||
(int)CONFIG_FILE_STAT_INTERVAL);
|
||||
eResult=EGSWConfigResult__NotChanged;
|
||||
}
|
||||
|
@ -264,14 +265,14 @@ GSWConfig_ReadIFND(CONST char *p_pszConfigPath,
|
|||
if (stStat.st_mtime>timePrevious)
|
||||
{
|
||||
GSWLog(GSW_INFO,p_pLogServerData,
|
||||
"GSWeb: GSWConfig_ReadIFND: Reading new configuration from %s",
|
||||
"GSWConfig_ReadIFND: Reading new configuration from %s",
|
||||
p_pszConfigPath);
|
||||
|
||||
*p_ppPropList=PLGetProplistWithPath(p_pszConfigPath);
|
||||
if (*p_ppPropList)
|
||||
{
|
||||
GSWLog(GSW_WARNING,p_pLogServerData,
|
||||
"GSWeb: GSWConfig_ReadIFND: New configuration from %s readen",
|
||||
"GSWConfig_ReadIFND: New configuration from %s readen",
|
||||
p_pszConfigPath);
|
||||
}
|
||||
else
|
||||
|
@ -284,20 +285,20 @@ GSWConfig_ReadIFND(CONST char *p_pszConfigPath,
|
|||
else
|
||||
{
|
||||
GSWLog(GSW_INFO,p_pLogServerData,
|
||||
"GSWeb: GSWConfig_ReadIFND: Not Reading : config file not modified since last read.");
|
||||
"GSWConfig_ReadIFND: Not Reading : config file not modified since last read.");
|
||||
eResult=EGSWConfigResult__NotChanged;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GSWLog(GSW_CRITICAL,p_pLogServerData,
|
||||
"GSWeb: GSWConfig_ReadIFND: config file %s does not exist.",
|
||||
"GSWConfig_ReadIFND: config file %s does not exist.",
|
||||
p_pszConfigPath);
|
||||
eResult=EGSWConfigResult__Error;
|
||||
};
|
||||
};
|
||||
};
|
||||
GSWLog(GSW_INFO,p_pLogServerData,"GSWeb: GSWConfig_ReadIFND: result= %d",
|
||||
GSWLog(GSW_INFO,p_pLogServerData,"GSWConfig_ReadIFND: result= %d",
|
||||
(int)eResult);
|
||||
return eResult;
|
||||
};
|
||||
|
@ -668,8 +669,17 @@ GSWConfig_PropListApplicationToApplication(GSWApp *p_pApp,
|
|||
};
|
||||
};
|
||||
};
|
||||
|
||||
//Remove Not Valid Instances
|
||||
GSWApp_FreeNotValidInstances(p_pApp);
|
||||
|
||||
//Initialize first instance index
|
||||
{
|
||||
unsigned int instanceCount=GSWDict_Count(&p_pApp->stInstancesDict);
|
||||
//use also pid because mutiple server can be initialized at the same time
|
||||
srand(time(NULL)+getpid());
|
||||
p_pApp->iLastInstanceIndex=(int)(((float)instanceCount)*rand()/(RAND_MAX+1.0));
|
||||
};
|
||||
return fOk;
|
||||
};
|
||||
|
||||
|
@ -681,7 +691,7 @@ GSWConfig_LoadConfiguration(void *p_pLogServerData)
|
|||
proplist_t propListConfig=NULL;
|
||||
p_pLogServerData=NULL;
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,
|
||||
"GSWeb: GSWConfig_LoadConfiguration");
|
||||
"GSWConfig_LoadConfiguration");
|
||||
|
||||
GSWLock_Lock(g_lockAppList);
|
||||
|
||||
|
|
|
@ -52,8 +52,8 @@ GSWLoadBalancing_FindApp(GSWAppRequest *p_pAppRequest,
|
|||
{
|
||||
BOOL fFound=FALSE;
|
||||
GSWApp *pApp=NULL;
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,"Start GSWLoadBalancing_FindApp");
|
||||
GSWLog(GSW_INFO,p_pLogServerData,"LoadBalance: looking for %s",
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,"LoadBalancing: Start GSWLoadBalancing_FindApp");
|
||||
GSWLog(GSW_INFO,p_pLogServerData,"LoadBalancing: looking for %s",
|
||||
p_pAppRequest->pszName);
|
||||
GSWConfig_LoadConfiguration(p_pLogServerData);
|
||||
GSWLock_Lock(g_lockAppList);
|
||||
|
@ -68,10 +68,13 @@ GSWLoadBalancing_FindApp(GSWAppRequest *p_pAppRequest,
|
|||
|
||||
while (!fFound && iTries-->0)
|
||||
{
|
||||
pApp->iIndex = (pApp->iIndex+1) % uInstancesCount;
|
||||
pApp->iLastInstanceIndex = (pApp->iLastInstanceIndex+1) % uInstancesCount;
|
||||
GSWLog(GSW_DEBUG,p_pLogServerData,"LoadBalancing: Will try instance %d (instances count=%d).",
|
||||
pApp->iLastInstanceIndex,uInstancesCount);
|
||||
pAppInstance =
|
||||
(GSWAppInstance *)GSWDict_ValueForKey(&pApp->stInstancesDict,
|
||||
GSWList_ElementAtIndex(pInstancesList,pApp->iIndex));
|
||||
GSWList_ElementAtIndex(pInstancesList,
|
||||
pApp->iLastInstanceIndex));
|
||||
if (pAppInstance)
|
||||
{
|
||||
if (!pAppInstance->pApp)
|
||||
|
@ -86,9 +89,9 @@ GSWLoadBalancing_FindApp(GSWAppRequest *p_pAppRequest,
|
|||
time(&curTime);
|
||||
if (pAppInstance->timeNextRetryTime<curTime)
|
||||
{
|
||||
GSWLog(GSW_CRITICAL,
|
||||
GSWLog(GSW_WARNING,
|
||||
p_pLogServerData,
|
||||
"LoadBalance: Instance %s:%d was marked dead for %d secs. Now resurecting !",
|
||||
"LoadBalance: Instance %s:%d was marked dead for %d secs. Now resurecting !",
|
||||
p_pAppRequest->pszName,
|
||||
pAppInstance->iInstance,
|
||||
APP_CONNECT_RETRY_DELAY);
|
||||
|
@ -138,10 +141,10 @@ GSWLoadBalancing_FindApp(GSWAppRequest *p_pAppRequest,
|
|||
GSWList_Free(pInstancesList,FALSE);
|
||||
};
|
||||
GSWLock_Unlock(g_lockAppList);
|
||||
|
||||
|
||||
if (fFound)
|
||||
GSWLog(GSW_INFO,p_pLogServerData,
|
||||
"LoadBalance: looking for %s, fFound instance %d on %s:%d",
|
||||
"LoadBalance: looking for %s, found instance %d on %s:%d",
|
||||
p_pAppRequest->pszName,
|
||||
p_pAppRequest->iInstance,
|
||||
p_pAppRequest->pszHost,
|
||||
|
@ -236,9 +239,13 @@ GSWLoadBalancing_MarkNotRespondingApp(GSWAppRequest *p_pAppRequest,
|
|||
time(&now);
|
||||
pAppInstance = p_pAppRequest->pAppInstance;
|
||||
pAppInstance->uOpenedRequestsNb--;
|
||||
pAppInstance->uNotRespondingRequestsNb++;
|
||||
pAppInstance->timeNextRetryTime=now+APP_CONNECT_RETRY_DELAY;
|
||||
GSWLog(GSW_WARNING,p_pLogServerData,"Marking %s unresponsive",
|
||||
p_pAppRequest->pszName);
|
||||
GSWLog(GSW_WARNING,p_pLogServerData,
|
||||
"Marking %s unresponsive for %d s. notResonding count: %u handled count: %u",
|
||||
p_pAppRequest->pszName,(int)APP_CONNECT_RETRY_DELAY,
|
||||
pAppInstance->uNotRespondingRequestsNb,
|
||||
pAppInstance->uHandledRequestsNb);
|
||||
if (!pAppInstance->fValid)
|
||||
{
|
||||
if (GSWAppInstance_FreeIFND(pAppInstance))
|
||||
|
@ -268,6 +275,7 @@ GSWLoadBalancing_StopAppRequest(GSWAppRequest *p_pAppRequest,
|
|||
GSWAppInstance *pAppInstance=p_pAppRequest->pAppInstance;
|
||||
GSWLock_Lock(g_lockAppList);
|
||||
pAppInstance->uOpenedRequestsNb--;
|
||||
pAppInstance->uHandledRequestsNb++;
|
||||
if (!pAppInstance->fValid)
|
||||
{
|
||||
if (GSWAppInstance_FreeIFND(pAppInstance))
|
||||
|
|
|
@ -87,17 +87,18 @@ VGSWLogSizedIntern(char *file,
|
|||
szBuffer[p_iBufferSize+511] = 0;
|
||||
|
||||
#if defined(Netscape)
|
||||
log_error(0,"GSWeb",NULL,NULL,szBuffer);
|
||||
log_error(0,"GSWeb: ",NULL,NULL,szBuffer);
|
||||
#endif
|
||||
|
||||
#if defined(Apache)
|
||||
#if defined(Apache2)
|
||||
ap_log_error(APLOG_MARK,p_iLevel,0,
|
||||
(server_rec *)p_pLogServerData,
|
||||
"%s",szBuffer);
|
||||
"GSWeb[%lu]: %s",(unsigned long)getpid(),szBuffer);
|
||||
#else
|
||||
ap_log_error(APLOG_MARK,p_iLevel,
|
||||
(server_rec *)p_pLogServerData,
|
||||
"%s",szBuffer);
|
||||
"GSWeb[%lu]: %s",(unsigned long)getpid(),szBuffer);
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
@ -536,6 +537,31 @@ GSWUtil_HostLookup(CONST char *p_pszHost,
|
|||
return pHost;
|
||||
};
|
||||
|
||||
// buffer should be at leat 20 characters
|
||||
// [dollar]Revision: 1.12 [dollar] ==> 1.12
|
||||
char* RevisionStringToRevisionValue(char* buffer,const char* revisionString)
|
||||
{
|
||||
char* dstBuffer=buffer;
|
||||
while(*revisionString && *revisionString!=':')
|
||||
revisionString++;
|
||||
if (*revisionString==':')
|
||||
{
|
||||
while(*revisionString && !isdigit(*revisionString))
|
||||
revisionString++;
|
||||
if (isdigit(*revisionString))
|
||||
{
|
||||
while(*revisionString && (isdigit(*revisionString) || *revisionString=='.') && (dstBuffer-buffer)<20)
|
||||
{
|
||||
*dstBuffer=*revisionString;
|
||||
revisionString++;
|
||||
dstBuffer++;
|
||||
};
|
||||
};
|
||||
};
|
||||
*dstBuffer=0;
|
||||
return buffer;
|
||||
};
|
||||
|
||||
#ifdef Apache2
|
||||
// 2003/04/05 10:12:25.123
|
||||
void FormatAPRTime(char *date_str, apr_time_t t)
|
||||
|
|
|
@ -122,6 +122,8 @@ PSTHostent GSWUtil_FindHost(CONST char *p_pszHost, void *p_pLogServerData);
|
|||
|
||||
void GSWLog_Init(GSWDict *p_pDict, int p_iLevel);
|
||||
|
||||
char* RevisionStringToRevisionValue(char* buffer,const char* revisionString);
|
||||
|
||||
#ifdef Apache2
|
||||
void FormatAPRTime(char *date_str, apr_time_t t); // 2003/04/05 10:12:25.123
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue