Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/cfreyfh/context.Orion-LD
Browse files Browse the repository at this point in the history
…into develop
  • Loading branch information
cfreyfh committed Aug 25, 2023
2 parents c0ecebd + aa4285a commit d18b8b3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
14 changes: 6 additions & 8 deletions src/lib/cache/subCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,12 @@ int subCacheMatch
//
void subCacheItemStrip(CachedSubscription* cSubP)
{
if (cSubP->subscriptionId != NULL)
{
free(cSubP->subscriptionId);
cSubP->subscriptionId = NULL;
}

if (cSubP->description != NULL)
{
free(cSubP->description);
Expand Down Expand Up @@ -668,12 +674,6 @@ void subCacheItemStrip(CachedSubscription* cSubP)
*/
void subCacheItemDestroy(CachedSubscription* cSubP)
{
if (cSubP->subscriptionId != NULL)
{
free(cSubP->subscriptionId);
cSubP->subscriptionId = NULL;
}

subCacheItemStrip(cSubP);

cSubP->next = NULL;
Expand Down Expand Up @@ -746,9 +746,7 @@ CachedSubscription* subCacheItemLookup(const char* tenant, const char* subscript
while (cSubP != NULL)
{
if ((tenantMatch(tenant, cSubP->tenant)) && (strcmp(subscriptionId, cSubP->subscriptionId) == 0))
{
return cSubP;
}

cSubP = cSubP->next;
}
Expand Down
3 changes: 2 additions & 1 deletion src/lib/logMsg/traceLevels.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ typedef enum TraceLevels
//
// Misc
//
LmtMongoc = 240, // Entire mongoc library
LmtMongoc = 230, // Entire mongoc library
LmtSR, // Service Routine (whatever it is doing)
LmtSemaphore, // Semaphores
LmtKjlParse, // Trace level start for K libs
Expand All @@ -109,6 +109,7 @@ typedef enum TraceLevels
LmtSql, // SQL command for TRoE
LmtPgPool, // Postgres Connection Pool
LmtSocketService, // Socket Service

LmtCurl = 250, // CURL library
LmtToDo, // To Do list
LmtPatchEntity, // Real merge+patch
Expand Down
25 changes: 13 additions & 12 deletions src/lib/orionld/common/subCacheApiSubscriptionInsert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ extern "C"
//
// subCacheItemFill -
//
static CachedSubscription* subCacheItemFill
static void subCacheItemFill
(
CachedSubscription* cSubP,
KjNode* apiSubscriptionP,
Expand Down Expand Up @@ -309,7 +309,8 @@ static CachedSubscription* subCacheItemFill
if (mqttParse(url, &mqtts, &mqttUser, &mqttPassword, &mqttHost, &mqttPort, &mqttTopic, &detail) == false)
{
LM_E(("Internal Error (unable to parse mqtt URL)"));
return NULL;
cSubP->isActive = false;
return;
}

if (mqttUser != NULL) strncpy(cSubP->httpInfo.mqtt.username, mqttUser, sizeof(cSubP->httpInfo.mqtt.username) - 1);
Expand Down Expand Up @@ -385,10 +386,6 @@ static CachedSubscription* subCacheItemFill

if (geoCoordinatesP != NULL)
cSubP->geoCoordinatesP = kjClone(NULL, geoCoordinatesP);

subCacheItemInsert(cSubP);

return cSubP;
}


Expand All @@ -411,7 +408,9 @@ static CachedSubscription* subCacheApiSubscriptionCreate
{
CachedSubscription* cSubP = new CachedSubscription();

return subCacheItemFill(cSubP, apiSubscriptionP, qTree, geoCoordinatesP, contextP, tenant, showChangesP, sysAttrsP, renderFormat);
subCacheItemFill(cSubP, apiSubscriptionP, qTree, geoCoordinatesP, contextP, tenant, showChangesP, sysAttrsP, renderFormat);
subCacheItemInsert(cSubP);
return cSubP;
}


Expand Down Expand Up @@ -459,10 +458,12 @@ static CachedSubscription* subCacheApiSubscriptionUpdate
cSubP->modifiedAt = modifiedAtNode->value.f; // The new value is in the DB
}

cSubP->count = 0; // Not sure ... count+dbCount ...
cSubP->count = 0;

subCacheItemStrip(cSubP);
return subCacheItemFill(cSubP, apiSubscriptionP, qTree, geoCoordinatesP, contextP, tenant, showChangesP, sysAttrsP, renderFormat);
subCacheItemFill(cSubP, apiSubscriptionP, qTree, geoCoordinatesP, contextP, tenant, showChangesP, sysAttrsP, renderFormat);

return cSubP;
}


Expand Down Expand Up @@ -491,12 +492,12 @@ CachedSubscription* subCacheApiSubscriptionInsert
if (subIdNodeP == NULL)
{
kjTreeLog(apiSubscriptionP, "apiSubscriptionP", LmtSubCacheSync);
LM_X(1, ("Subscription without id - exiting dur to bug"));
LM_X(1, ("Subscription without id - exiting due to bug"));
}

char* subId = subIdNodeP->value.s;
char* subId = subIdNodeP->value.s;
CachedSubscription* subP = subCacheItemLookup(tenant, subId);

CachedSubscription* subP = subCacheItemLookup(tenant, subId);
if (subP == NULL)
return subCacheApiSubscriptionCreate(apiSubscriptionP, qTree, geoCoordinatesP, contextP, tenant, showChangesP, sysAttrsP, renderFormat);

Expand Down

0 comments on commit d18b8b3

Please sign in to comment.