Enhanced the RPC retry logic for the Windows client to be bounded by time rather than number of retries. Also, added a pause between retries to avoid saturating the network. The corresponding Linux client changes still need to be made. This changes allow us to support large number of clients against a single server.
This commit is contained in:
parent
8d0d55a666
commit
8ea377f845
@ -553,7 +553,7 @@ Rpc(
|
|||||||
//=======================================================================--
|
//=======================================================================--
|
||||||
{
|
{
|
||||||
CasaStatus retStatus;
|
CasaStatus retStatus;
|
||||||
int retries = 3;
|
int retries = 0;
|
||||||
|
|
||||||
DbgTrace(1, "-Rpc- Start\n", 0);
|
DbgTrace(1, "-Rpc- Start\n", 0);
|
||||||
|
|
||||||
|
@ -543,6 +543,20 @@ NormalizeHostName(
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
DbgTrace(0, "-NormalizeHostName- Name resolution failed, error = %d\n", WSAGetLastError());
|
DbgTrace(0, "-NormalizeHostName- Name resolution failed, error = %d\n", WSAGetLastError());
|
||||||
|
|
||||||
|
// Not able to resolve the name in DNS, just use the host name as
|
||||||
|
// the normalized name.
|
||||||
|
pEntry->buffLengthRequired = strlen(pHostName) + 1;
|
||||||
|
pEntry->pNormalizedHostName = (char*) malloc(pEntry->buffLengthRequired);
|
||||||
|
if (pEntry->pNormalizedHostName)
|
||||||
|
{
|
||||||
|
// Copy the host name
|
||||||
|
strcpy(pEntry->pNormalizedHostName, pHostName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DbgTrace(0, "-NormalizeHostName- Buffer allocation error\n", 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -33,6 +33,8 @@
|
|||||||
#define INCREMENT_RESPONSE_DATA_BUF_SIZE 256
|
#define INCREMENT_RESPONSE_DATA_BUF_SIZE 256
|
||||||
|
|
||||||
#define MAX_RPC_RETRIES 3
|
#define MAX_RPC_RETRIES 3
|
||||||
|
#define MILLISECONDS_BETWEEN_RPC_RETRIES 3000
|
||||||
|
#define MAX_RPC_TIME_MILLISECONDS 60000
|
||||||
|
|
||||||
//===[ Function prototypes ]===============================================
|
//===[ Function prototypes ]===============================================
|
||||||
|
|
||||||
@ -776,13 +778,38 @@ Rpc(
|
|||||||
//=======================================================================--
|
//=======================================================================--
|
||||||
{
|
{
|
||||||
CasaStatus retStatus;
|
CasaStatus retStatus;
|
||||||
int retries = 3;
|
int retries = 0;
|
||||||
|
DWORD startTime = GetTickCount();
|
||||||
|
DWORD currentTime;
|
||||||
|
|
||||||
DbgTrace(1, "-Rpc- Start\n", 0);
|
DbgTrace(1, "-Rpc- Start\n", 0);
|
||||||
|
|
||||||
// Retry the RPC as needed
|
// Retry the RPC as needed
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
// Check if this is a retry
|
||||||
|
if (retries != 0)
|
||||||
|
{
|
||||||
|
// This is a retry, check if we should keep retrying.
|
||||||
|
currentTime = GetTickCount();
|
||||||
|
if (currentTime > startTime)
|
||||||
|
{
|
||||||
|
if ((currentTime - startTime) > MAX_RPC_TIME_MILLISECONDS)
|
||||||
|
{
|
||||||
|
DbgTrace(1, "-Rpc- Stopping after %d retries\n", retries);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// The clock must have wrapped, treat it as if no time has elapsed.
|
||||||
|
startTime = currentTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pause before the next retry
|
||||||
|
Sleep(MILLISECONDS_BETWEEN_RPC_RETRIES);
|
||||||
|
}
|
||||||
|
|
||||||
// Issue the RPC
|
// Issue the RPC
|
||||||
retStatus = InternalRpc(pSession,
|
retStatus = InternalRpc(pSession,
|
||||||
pMethod,
|
pMethod,
|
||||||
@ -794,10 +821,7 @@ Rpc(
|
|||||||
// Account for this try
|
// Account for this try
|
||||||
retries ++;
|
retries ++;
|
||||||
|
|
||||||
|
} while (CasaStatusCode(retStatus) == CASA_STATUS_CONNECTION_ERROR);
|
||||||
|
|
||||||
} while (CasaStatusCode(retStatus) == CASA_STATUS_CONNECTION_ERROR
|
|
||||||
&& retries < MAX_RPC_RETRIES);
|
|
||||||
|
|
||||||
DbgTrace(1, "-Rpc- End, retStatus = %0X\n", retStatus);
|
DbgTrace(1, "-Rpc- End, retStatus = %0X\n", retStatus);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user