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

RBUS-Update logging messages #174

Merged
merged 5 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/core/rbuscore.c
Original file line number Diff line number Diff line change
Expand Up @@ -2779,7 +2779,7 @@ rbusCoreError_t rbuscore_startPrivateListener(const char* pPrivateConnAddress, c

if((err = pthread_create(&pid, NULL, rbuscore_PrivateThreadFunc, pInstance)) != 0)
{
RBUSCORELOG_ERROR("%s pthread_create failed: err=%d", __FUNCTION__, err);
RBUSCORELOG_ERROR("pthread_create failed: err=%d", err);
directServerUnlock();
return RBUSCORE_ERROR_GENERAL;
}
Expand Down
317 changes: 157 additions & 160 deletions src/rbus/rbus.c

Large diffs are not rendered by default.

39 changes: 19 additions & 20 deletions src/rbus/rbus_asyncsubscribe.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ static int rbusAsyncSubscribeRetrier_DetermineNextSendTime(rtTime_t* nextSendTim
rtTime_Now(&now);
rtTime_Later(&now, rbusConfig_Get()->subscribeMaxWait + 1000, nextSendTime);

RBUSLOG_DEBUG("%s now=%s", __FUNCTION__, rtTime_ToString(&now, tbuff));
RBUSLOG_DEBUG("now=%s", rtTime_ToString(&now, tbuff));

if(!li)
{
Expand All @@ -126,7 +126,7 @@ static int rbusAsyncSubscribeRetrier_DetermineNextSendTime(rtTime_t* nextSendTim
AsyncSubscription_t* item;
rtListItem_GetData(li, (void**)&item);

RBUSLOG_INFO("%s item=%s", __FUNCTION__, rtTime_ToString(&item->nextRetryTime, tbuff));
RBUSLOG_INFO("item=%s", rtTime_ToString(&item->nextRetryTime, tbuff));

if(rtTime_Compare(&item->nextRetryTime, nextSendTime) < 0)
{
Expand All @@ -139,7 +139,7 @@ static int rbusAsyncSubscribeRetrier_DetermineNextSendTime(rtTime_t* nextSendTim
//if nextSendTime is past due, return 1 so the caller knows to send requests now
if(rtTime_Compare(nextSendTime, &now) <= 0)
{
RBUSLOG_INFO("%s subs past due", __FUNCTION__);
RBUSLOG_INFO("subs past due");
return 1;
}

Expand All @@ -148,7 +148,7 @@ static int rbusAsyncSubscribeRetrier_DetermineNextSendTime(rtTime_t* nextSendTim
//this will essentially batch all items due between now and this next time
rtTime_Later(nextSendTime, 1000, nextSendTime);
#endif
RBUSLOG_INFO("%s subs due in %d miliseconds nextSendTime=%s", __FUNCTION__,
RBUSLOG_INFO("subs due in %d miliseconds nextSendTime=%s",
rtTime_Elapsed(&now, nextSendTime),
rtTime_ToString(nextSendTime, tbuff));

Expand Down Expand Up @@ -178,7 +178,7 @@ static void rbusAsyncSubscribeRetrier_SendSubscriptionRequests()
int elapsed;
int providerError;

RBUSLOG_INFO("%s: %s subscribing", __FUNCTION__, item->subscription->eventName);
RBUSLOG_INFO("%s subscribing", item->subscription->eventName);

coreerr = rbus_subscribeToEvent(NULL, item->subscription->eventName,
_event_callback_handler, item->payload, item->subscription, &providerError);
Expand Down Expand Up @@ -211,8 +211,7 @@ static void rbusAsyncSubscribeRetrier_SendSubscriptionRequests()
rtTime_Later(&item->startTime, rbusConfig_Get()->subscribeTimeout, &item->nextRetryTime);
}

RBUSLOG_INFO("%s: %s no provider. retry in %d ms with %d left",
__FUNCTION__,
RBUSLOG_INFO("%s no provider. retry in %d ms with %d left",
item->subscription->eventName,
rtTime_Elapsed(&now, &item->nextRetryTime),
rbusConfig_Get()->subscribeTimeout - elapsed );
Expand All @@ -224,26 +223,26 @@ static void rbusAsyncSubscribeRetrier_SendSubscriptionRequests()

if(coreerr == RBUSCORE_SUCCESS)
{
RBUSLOG_INFO("%s: %s subscribe retries succeeded", __FUNCTION__, item->subscription->eventName);
RBUSLOG_INFO("%s subscribe retries succeeded", item->subscription->eventName);
responseErr = RBUS_ERROR_SUCCESS;
}
else
{
if(coreerr == RBUSCORE_ERROR_DESTINATION_UNREACHABLE)
{
RBUSLOG_INFO("%s: %s all subscribe retries failed and no provider found", __FUNCTION__, item->subscription->eventName);
RBUSLOG_INFO("%s all subscribe retries failed and no provider found", item->subscription->eventName);
RBUSLOG_WARN("EVENT_SUBSCRIPTION_FAIL_NO_PROVIDER_COMPONENT %s", item->subscription->eventName);/*RDKB-33658-AC7*/
responseErr = RBUS_ERROR_TIMEOUT;
}
else if(providerError != RBUS_ERROR_SUCCESS)
{
RBUSLOG_INFO("%s: %s subscribe retries failed due provider error %d", __FUNCTION__, item->subscription->eventName, providerError);
RBUSLOG_INFO("%s subscribe retries failed due provider error %d", item->subscription->eventName, providerError);
RBUSLOG_WARN("EVENT_SUBSCRIPTION_FAIL_INVALID_INPUT %s", item->subscription->eventName);/*RDKB-33658-AC9*/
responseErr = providerError;
}
else
{
RBUSLOG_INFO("%s: %s subscribe retries failed due to core error %d", __FUNCTION__, item->subscription->eventName, coreerr);
RBUSLOG_INFO("%s subscribe retries failed due to core error %d", item->subscription->eventName, coreerr);
responseErr = RBUS_ERROR_BUS_ERROR;
}
}
Expand Down Expand Up @@ -285,7 +284,7 @@ static void* AsyncSubscribeRetrier_threadFunc(void* data)
rtTimespec_t ts;
int err;

RBUSLOG_DEBUG("%s timedwait until %s", __FUNCTION__, rtTime_ToString(&nextSendTime, tbuff));
RBUSLOG_DEBUG("timedwait until %s", rtTime_ToString(&nextSendTime, tbuff));

err = pthread_cond_timedwait(&gRetrier->condItemAdded,
&gRetrier->mutexQueue,
Expand All @@ -295,7 +294,7 @@ static void* AsyncSubscribeRetrier_threadFunc(void* data)
RBUSLOG_ERROR("Error %d:%s running command pthread_cond_timedwait", err, strerror(err));
}

RBUSLOG_DEBUG("%s waked up", __FUNCTION__);
RBUSLOG_DEBUG("waked up");
//either we timed out or a new subscription was added
//in either case, loop back to top and things will get handled properly
}
Expand All @@ -309,7 +308,7 @@ static void rbusAsyncSubscribeRetrier_Create()
pthread_mutexattr_t mattrib;
pthread_condattr_t cattrib;

RBUSLOG_INFO("%s enter", __FUNCTION__);
RBUSLOG_DEBUG("%s enter", __FUNCTION__);

gRetrier = rt_malloc(sizeof(struct AsyncSubscribeRetrier_t));

Expand All @@ -328,12 +327,12 @@ static void rbusAsyncSubscribeRetrier_Create()

ERROR_CHECK(pthread_create(&gRetrier->threadId, NULL, AsyncSubscribeRetrier_threadFunc, NULL));

RBUSLOG_INFO("%s exit", __FUNCTION__);
RBUSLOG_DEBUG("%s exit", __FUNCTION__);
}

static void rbusAsyncSubscribeRetrier_Destroy()
{
RBUSLOG_INFO("%s enter", __FUNCTION__);
RBUSLOG_DEBUG("%s enter", __FUNCTION__);

LOCK();
gRetrier->isRunning = false;
Expand All @@ -350,7 +349,7 @@ static void rbusAsyncSubscribeRetrier_Destroy()
free(gRetrier);
gRetrier = NULL;

RBUSLOG_INFO("%s exit", __FUNCTION__);
RBUSLOG_DEBUG("%s exit", __FUNCTION__);
}

void rbusAsyncSubscribe_AddSubscription(rbusEventSubscription_t* subscription, rbusMessage payload)
Expand All @@ -375,7 +374,7 @@ void rbusAsyncSubscribe_AddSubscription(rbusEventSubscription_t* subscription, r
rtTime_Now(&item->startTime);
item->nextRetryTime = item->startTime; /*set to now also so we do our first sub immediately*/

RBUSLOG_INFO("%s %s %s", __FUNCTION__, subscription->eventName, rtTime_ToString(&item->startTime, tbuff));
RBUSLOG_INFO("%s %s", subscription->eventName, rtTime_ToString(&item->startTime, tbuff));

LOCK();
rtList_PushBack(gRetrier->items, item, NULL);
Expand Down Expand Up @@ -431,7 +430,7 @@ void rbusAsyncSubscribe_CloseHandle(rbusHandle_t handle)
if(!gRetrier)
return;

RBUSLOG_INFO("%s", __FUNCTION__);
RBUSLOG_DEBUG("%s", __FUNCTION__);

LOCK();

Expand All @@ -450,7 +449,7 @@ void rbusAsyncSubscribe_CloseHandle(rbusHandle_t handle)

if(size == 0)
{
RBUSLOG_INFO("%s all handles removed", __FUNCTION__);
RBUSLOG_INFO("all handles removed");
rbusAsyncSubscribeRetrier_Destroy();
}
}
12 changes: 6 additions & 6 deletions src/rbus/rbus_element.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ elementNode* insertElement(elementNode* root, rbusDataElement_t* elem)
nextNode = currentNode->child;
createChild = 1;

RBUSLOG_DEBUG("<%s>: Request to insert element [%s]!!", __FUNCTION__, elem->name);
RBUSLOG_DEBUG("Request to insert element [%s]!!", elem->name);

name = strdup(elem->name);

Expand Down Expand Up @@ -386,7 +386,7 @@ elementNode* retrieveElement(elementNode* root, const char* elmentName)
int tokenFound = 0;

LOCK();
RBUSLOG_DEBUG("<%s>: Request to retrieve element [%s]", __FUNCTION__, elmentName);
RBUSLOG_DEBUG("Request to retrieve element [%s]", elmentName);
if(currentNode == NULL)
{
return NULL;
Expand Down Expand Up @@ -481,7 +481,7 @@ elementNode* retrieveInstanceElement(elementNode* root, const char* elmentName)
int tokenFound = 0;
bool isWildcard = false;

RBUSLOG_DEBUG("<%s>: Request to retrieve element [%s]", __FUNCTION__, elmentName);
RBUSLOG_DEBUG("Request to retrieve element [%s]", elmentName);
LOCK();
if(currentNode == NULL)
{
Expand Down Expand Up @@ -977,7 +977,7 @@ elementNode* instantiateTableRow(elementNode* tableNode, uint32_t instNum, char

LOCK();
#if DEBUG_ELEMENTS
RBUSLOG_INFO("%s: table=%s instNum=%u alias=%s", __FUNCTION__, tableNode->fullName, instNum, alias);
RBUSLOG_INFO("table=%s instNum=%u alias=%s", tableNode->fullName, instNum, alias);
printElement(tableNode, 0);
#endif

Expand Down Expand Up @@ -1005,7 +1005,7 @@ elementNode* instantiateTableRow(elementNode* tableNode, uint32_t instNum, char
if(!rowTemplate)
{
assert(false);
RBUSLOG_ERROR("%s ERROR: row template not found for table %s", __FUNCTION__, tableNode->fullName);
RBUSLOG_ERROR("ERROR: row template not found for table %s", tableNode->fullName);
return NULL;
}

Expand Down Expand Up @@ -1041,7 +1041,7 @@ void deleteTableRow(elementNode* rowNode)

if(!parent)
{
RBUSLOG_INFO("%s: row doesn't have a parent", __FUNCTION__);
RBUSLOG_INFO("row doesn't have a parent");
}
#if DEBUG_ELEMENTS
RBUSLOG_INFO("%s: row=%s", __FUNCTION__, rowNode->fullName);
Expand Down
6 changes: 3 additions & 3 deletions src/rbus/rbus_handle.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ void rbusHandleList_Add(struct _rbusHandle* handle)
VERIFY_NULL(handle,return);
if(!gHandleList)
rtVector_Create(&gHandleList);
RBUSLOG_DEBUG("%s adding %p", __FUNCTION__, handle);
RBUSLOG_DEBUG("adding %p", handle);
rtVector_PushBack(gHandleList, handle);
}

void rbusHandleList_Remove(struct _rbusHandle* handle)
{
VERIFY_NULL(handle,return);
RBUSLOG_DEBUG("%s removing %p", __FUNCTION__, handle);
RBUSLOG_DEBUG("removing %p", handle);
rtVector_RemoveItem(gHandleList, handle, rtVector_Cleanup_Free);
if(rtVector_Size(gHandleList) == 0)
{
Expand All @@ -53,7 +53,7 @@ bool rbusHandleList_IsEmpty()

bool rbusHandleList_IsFull()
{
RBUSLOG_DEBUG("%s size=%zu", __FUNCTION__, rtVector_Size(gHandleList));
RBUSLOG_DEBUG("size=%zu", rtVector_Size(gHandleList));
return (gHandleList && rtVector_Size(gHandleList) >= RBUS_MAX_HANDLES);
}

Expand Down
14 changes: 7 additions & 7 deletions src/rbus/rbus_intervalsubscription.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ static sRecord* sub_find(rbusSubscription_t* sub)
/* Publishing event based on subscriber interval */
static void* PublishingThreadFunc(void* rec)
{
RBUSLOG_DEBUG("\n %s: start\n", __FUNCTION__);
RBUSLOG_DEBUG("\n PublishingThreadFunc: start\n");
struct sRecord *sub_rec = (struct sRecord*)rec;
int count = 0;
int duration_count = 0;
Expand Down Expand Up @@ -151,7 +151,7 @@ static void* PublishingThreadFunc(void* rec)
rbusProperty_Release(properties);
if(result != RBUS_ERROR_SUCCESS)
{
RBUSLOG_ERROR("%s: failed to get details of %s", __FUNCTION__, sub->eventName);
RBUSLOG_ERROR("failed to get details of %s", sub->eventName);
rbusObject_Release(data);
continue;
}
Expand Down Expand Up @@ -187,7 +187,7 @@ static void* PublishingThreadFunc(void* rec)
rbusObject_Release(data);
if(error != RBUSCORE_SUCCESS)
{
RBUSLOG_ERROR("%s: rbusEvent_Publish failed with result=%d", __FUNCTION__, result);
RBUSLOG_ERROR("Event_Publish failed with result=%d", result);
}

if (duration_complete)
Expand Down Expand Up @@ -221,19 +221,19 @@ rbusError_t rbusInterval_AddSubscriptionRecord(
sRecord *sub_rec = NULL;
if(!propNode)
{
RBUSLOG_ERROR("%s: propNode NULL error", __FUNCTION__);
RBUSLOG_ERROR("propNode NULL error");
return RBUS_ERROR_INVALID_INPUT;
}

if(propNode->type != RBUS_ELEMENT_TYPE_PROPERTY)
{
RBUSLOG_ERROR("%s: propNode type %d error", __FUNCTION__, propNode->type);
RBUSLOG_ERROR("propNode type %d error", propNode->type);
return RBUS_ERROR_NOSUBSCRIBERS ;
}

if(!propNode->cbTable.getHandler)
{
RBUSLOG_ERROR("%s: as it does not have getHandler", __FUNCTION__);
RBUSLOG_ERROR("as it does not have getHandler");
return RBUS_ERROR_ACCESS_NOT_ALLOWED;
}

Expand Down Expand Up @@ -295,6 +295,6 @@ void rbusInterval_RemoveSubscriptionRecord(
}
else
{
RBUSLOG_ERROR("%s: value not found\n", __FUNCTION__);
RBUSLOG_ERROR("value not found\n");
}
}
Loading
Loading