Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

for non retriable failures, set the terminal exit status for state in… #1320

Merged
merged 3 commits into from
Nov 9, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/source/Signaling/LwsApiCalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,10 @@ STATUS lwsCompleteSync(PLwsCallInfo pCallInfo)
return retStatus;
}

BOOL isLwsCallResultFailureRetryable(PCallInfo pCallInfo) {
hassanctech marked this conversation as resolved.
Show resolved Hide resolved
return (STRSTR(pCallInfo->responseData, "Signature expired") == NULL);
hassanctech marked this conversation as resolved.
Show resolved Hide resolved
}

//////////////////////////////////////////////////////////////////////////
// API calls
//////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -689,6 +693,11 @@ STATUS describeChannelLws(PSignalingClient pSignalingClient, UINT64 time)
pResponseStr = pLwsCallInfo->callInfo.responseData;
resultLen = pLwsCallInfo->callInfo.responseDataLen;

if (!isLwsCallResultFailureRetryable(&pLwsCallInfo->callInfo)) {
hassanctech marked this conversation as resolved.
Show resolved Hide resolved
// Return early with terminal status code so there will be no lower level retries
CHK(FALSE, STATUS_SIGNALING_DESCRIBE_CALL_FAILED);
}

// Early return if we have a non-success result
CHK((SERVICE_CALL_RESULT) ATOMIC_LOAD(&pSignalingClient->result) == SERVICE_CALL_RESULT_OK && resultLen != 0 && pResponseStr != NULL, STATUS_SIGNALING_LWS_CALL_FAILED);

Expand Down Expand Up @@ -838,6 +847,12 @@ STATUS createChannelLws(PSignalingClient pSignalingClient, UINT64 time)
pResponseStr = pLwsCallInfo->callInfo.responseData;
resultLen = pLwsCallInfo->callInfo.responseDataLen;


if (!isLwsCallResultFailureRetryable(&pLwsCallInfo->callInfo)) {
// Return early with terminal status code so there will be no lower level retries
CHK(FALSE, STATUS_SIGNALING_CREATE_CALL_FAILED);
}

// Early return if we have a non-success result
CHK((SERVICE_CALL_RESULT) ATOMIC_LOAD(&pSignalingClient->result) == SERVICE_CALL_RESULT_OK && resultLen != 0 && pResponseStr != NULL, STATUS_SIGNALING_LWS_CALL_FAILED);

Expand Down Expand Up @@ -906,6 +921,8 @@ STATUS getChannelEndpointLws(PSignalingClient pSignalingClient, UINT64 time)
SIGNALING_SERVICE_API_CALL_CONNECTION_TIMEOUT, SIGNALING_SERVICE_API_CALL_COMPLETION_TIMEOUT,
DEFAULT_LOW_SPEED_LIMIT, DEFAULT_LOW_SPEED_TIME_LIMIT, pSignalingClient->pAwsCredentials, &pRequestInfo));

pRequestInfo->currentTime -= (10 * HUNDREDS_OF_NANOS_IN_A_MINUTE);
hassanctech marked this conversation as resolved.
Show resolved Hide resolved

CHK_STATUS(createLwsCallInfo(pSignalingClient, pRequestInfo, PROTOCOL_INDEX_HTTPS, &pLwsCallInfo));

// Make a blocking call
Expand All @@ -916,6 +933,11 @@ STATUS getChannelEndpointLws(PSignalingClient pSignalingClient, UINT64 time)
pResponseStr = pLwsCallInfo->callInfo.responseData;
resultLen = pLwsCallInfo->callInfo.responseDataLen;

if (!isLwsCallResultFailureRetryable(&pLwsCallInfo->callInfo)) {
// Return early with terminal status code so there will be no lower level retries
CHK(FALSE, STATUS_SIGNALING_GET_ENDPOINT_CALL_FAILED);
}

// Early return if we have a non-success result
CHK((SERVICE_CALL_RESULT) ATOMIC_LOAD(&pSignalingClient->result) == SERVICE_CALL_RESULT_OK && resultLen != 0 && pResponseStr != NULL, STATUS_SIGNALING_LWS_CALL_FAILED);

Expand Down Expand Up @@ -1051,6 +1073,11 @@ STATUS getIceConfigLws(PSignalingClient pSignalingClient, UINT64 time)
pResponseStr = pLwsCallInfo->callInfo.responseData;
resultLen = pLwsCallInfo->callInfo.responseDataLen;

if (!isLwsCallResultFailureRetryable(&pLwsCallInfo->callInfo)) {
// Return early with terminal status code so there will be no lower level retries
CHK(FALSE, STATUS_SIGNALING_GET_ICE_CONFIG_CALL_FAILED);
}

// Early return if we have a non-success result
CHK((SERVICE_CALL_RESULT) ATOMIC_LOAD(&pSignalingClient->result) == SERVICE_CALL_RESULT_OK && resultLen != 0 && pResponseStr != NULL, STATUS_SIGNALING_LWS_CALL_FAILED);

Expand Down