Skip to content

Commit

Permalink
Merge pull request rdkcentral#5458 from yuvaramachandran-gurusamy/mai…
Browse files Browse the repository at this point in the history
…n_RDKTV-30790

RDKTV-30790 added retry logic for IARM connect failure
  • Loading branch information
apatel859 authored Jun 25, 2024
2 parents 2eff555 + 417e8cd commit acd9957
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 12 deletions.
18 changes: 18 additions & 0 deletions helpers/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
All notable changes to this RDK Service will be documented in this file.

Each RDK Service has a CHANGELOG file that contains all changes done so far. When version is updated, add a entry in the CHANGELOG.md at the top with user friendly information on what was changed with the new version. Please don't mention JIRA tickets in CHANGELOG.

Please Add entry in the CHANGELOG for each version change and indicate the type of change with these labels:
Added for new features.
Changed for changes in existing functionality.
Deprecated for soon-to-be removed features.
Removed for now removed features.
Fixed for any bug fixes.
Security in case of vulnerabilities.

Changes in CHANGELOG should be updated when commits are added to the main or release branches. There should be one CHANGELOG entry per JIRA Ticket. This is not enforced on sprint branches since there could be multiple changes for the same JIRA ticket during development.

For more details, refer to versioning section under Main README.
## [1.0.1] - 2024-06-25
### Fixed
- Added retry logic for IARM connect failure
33 changes: 21 additions & 12 deletions helpers/UtilsIarm.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "UtilsLogging.h"

#include "libIBus.h"
#include <unistd.h>

#define IARM_CHECK(FUNC) { \
if ((res = FUNC) != IARM_RESULT_SUCCESS) { \
Expand All @@ -29,19 +30,27 @@ struct IARM {
LOGINFO("IARM already connected");
result = true;
} else {
res = IARM_Bus_Init(NAME);
LOGINFO("IARM_Bus_Init: %d", res);
if (res == IARM_RESULT_SUCCESS || res == IARM_RESULT_INVALID_STATE /* already inited or connected */) {
res = IARM_Bus_Connect();
LOGINFO("IARM_Bus_Connect: %d", res);
if (res == IARM_RESULT_SUCCESS || res == IARM_RESULT_INVALID_STATE /* already connected or not inited */) {
result = isConnected();
unsigned int retryCount = 0;
do
{
res = IARM_Bus_Init(NAME);
LOGINFO("IARM_Bus_Init: %d", res);
if (res == IARM_RESULT_SUCCESS || res == IARM_RESULT_INVALID_STATE /* already inited or connected */) {
res = IARM_Bus_Connect();
LOGINFO("IARM_Bus_Connect: %d", res);
if (res == IARM_RESULT_SUCCESS || res == IARM_RESULT_INVALID_STATE /* already connected or not inited */) {
result = isConnected();
LOGERR("ARM_Bus_Connect result: %d res: %d retryCount :%d ",result, res, retryCount);
} else {
LOGERR("IARM_Bus_Connect failure:result :%d res: %d retryCount :%d ",result, res, retryCount);
}
} else {
LOGERR("IARM_Bus_Connect failure: %d", res);
LOGERR("IARM_Bus_Init failure: result :%d res: %d retryCount :%d",result, res,retryCount);
}
} else {
LOGERR("IARM_Bus_Init failure: %d", res);
}

if(result == false) usleep(100000);

}while((result == false) && (retryCount++ < 20));
}

return result;
Expand All @@ -52,7 +61,7 @@ struct IARM {
IARM_Result_t res;
int isRegistered = 0;
res = IARM_Bus_IsConnected(NAME, &isRegistered);
LOGINFO("IARM_Bus_IsConnected: %d (%d)", res, isRegistered);
LOGINFO("IARM_Bus_IsConnected: res:%d isRegistered (%d)", res, isRegistered);

return (isRegistered == 1);
}
Expand Down

0 comments on commit acd9957

Please sign in to comment.