This is an automated email from the ASF dual-hosted git repository. pnoltes pushed a commit to branch feature/pstm_missing_receiver_fix in repository https://gitbox.apache.org/repos/asf/celix.git
commit 7d04ba81297b7f7312a2735fe65a8e04c6c1c3ba Author: Pepijn Noltes <[email protected]> AuthorDate: Mon Dec 5 16:52:09 2022 +0100 Improve error handling of setup topic senders/receivers in pstm --- .../pubsub_topology_manager/src/pubsub_topology_manager.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/bundles/pubsub/pubsub_topology_manager/src/pubsub_topology_manager.c b/bundles/pubsub/pubsub_topology_manager/src/pubsub_topology_manager.c index fdeb20cb..3e95e5db 100644 --- a/bundles/pubsub/pubsub_topology_manager/src/pubsub_topology_manager.c +++ b/bundles/pubsub/pubsub_topology_manager/src/pubsub_topology_manager.c @@ -337,9 +337,9 @@ void pubsub_topologyManager_subscriberAdded(void *handle, void *svc __attribute_ free(scopeAndTopicKey); } else { entry = calloc(1, sizeof(*entry)); - entry->scopeAndTopicKey = scopeAndTopicKey; //note taking owner ship - entry->scope = scope == NULL ? NULL : strndup(scope, 1024 * 1024); - entry->topic = strndup(topic, 1024 * 1024); + entry->scopeAndTopicKey = scopeAndTopicKey; //note taking ownership + entry->scope = scope == NULL ? NULL : celix_utils_strdup(scope); + entry->topic = celix_utils_strdup(topic); entry->usageCount = 1; entry->matching.selectedPsaSvcId = -1L; entry->matching.selectedSerializerSvcId = -1L; @@ -996,6 +996,10 @@ static void pstm_setupTopicSenders(pubsub_topology_manager_t *manager) { celixThreadMutex_unlock(&manager->topicSenders.mutex); } else { celix_logHelper_warning(manager->loghelper, "Cannot setup TopicSender for %s/%s\n", setupEntry->scope == NULL ? "(null)" : setupEntry->scope, setupEntry->topic); + celixThreadMutex_lock(&manager->topicSenders.mutex); + pstm_topic_receiver_or_sender_entry_t* entry = hashMap_get(manager->topicSenders.map, setupEntry->key); + entry->matching.needsMatch = false; + celixThreadMutex_unlock(&manager->topicSenders.mutex); celix_properties_destroy(setupEntry->topicProperties); celix_properties_destroy(setupEntry->endpointResult); } @@ -1109,6 +1113,10 @@ static void pstm_setupTopicReceivers(pubsub_topology_manager_t *manager) { celixThreadMutex_unlock(&manager->topicReceivers.mutex); } else { celix_logHelper_warning(manager->loghelper, "Cannot setup TopicReceiver for %s/%s\n", setupEntry->scope == NULL ? "(null)" : setupEntry->scope, setupEntry->topic); + celixThreadMutex_lock(&manager->topicReceivers.mutex); + pstm_topic_receiver_or_sender_entry_t* entry = hashMap_get(manager->topicReceivers.map, setupEntry->key); + entry->matching.needsMatch = true; + celixThreadMutex_unlock(&manager->topicReceivers.mutex); } free(setupEntry->scope); free(setupEntry->topic);
