Moves a debug log statement so that it only occurs when new endpoint are discovered
@@ -459,6 +459,12 @@ static void pubsub_discovery_addDiscoveredEndpoint(pubsub_discovery_t *disc, cel
return;
}
+ celixThreadMutex_lock(&disc->discoveredEndpointsMutex);
+ bool exists = hashMap_containsKey(disc->discoveredEndpoints, (void*)uuid);
+ hashMap_put(disc->discoveredEndpoints, (void*)uuid, endpoint);
+ celixThreadMutex_unlock(&disc->discoveredEndpointsMutex);
+
+ if (!exists) {
if (disc->verbose) {
const char *uuid = celix_properties_get(endpoint, PUBSUB_ENDPOINT_UUID, "!Error!");
const char *type = celix_properties_get(endpoint, PUBSUB_ENDPOINT_TYPE, "!Error!");
@@ -468,12 +474,6 @@ static void pubsub_discovery_addDiscoveredEndpoint(pubsub_discovery_t *disc, cel
uuid, type, admin, ser);
}
- celixThreadMutex_lock(&disc->discoveredEndpointsMutex);
- bool exists = hashMap_containsKey(disc->discoveredEndpoints, (void*)uuid);
- hashMap_put(disc->discoveredEndpoints, (void*)uuid, endpoint);
- celixThreadMutex_unlock(&disc->discoveredEndpointsMutex);
-
- if (!exists) {
celixThreadMutex_lock(&disc->discoveredEndpointsListenersMutex);
hash_map_iterator_t iter = hashMapIterator_construct(disc->discoveredEndpointsListeners);
while (hashMapIterator_hasNext(&iter)) {
