PengZheng commented on code in PR #710: URL: https://github.com/apache/celix/pull/710#discussion_r1443934255
########## bundles/remote_services/remote_service_admin_dfi/src/remote_service_admin_dfi.c: ########## @@ -954,6 +981,42 @@ celix_status_t remoteServiceAdmin_removeImportedService(remote_service_admin_t * static celix_status_t remoteServiceAdmin_send(void *handle, endpoint_description_t *endpointDescription, char *request, celix_properties_t *metadata, char **reply, int* replyStatus) { remote_service_admin_t * rsa = handle; + celix_autoptr(celix_string_hash_map_t) ipAddressMap = NULL; + celix_autofree char *ipStrListCopy = NULL; + const char *ipaddresses = celix_properties_get(endpointDescription->properties, (char*) CELIX_RSA_DFI_ZEROCONF_ENDPOINT_IPADDRESSES, NULL); + if (ipaddresses != NULL) { + celix_string_hash_map_create_options_t opts = CELIX_EMPTY_STRING_HASH_MAP_CREATE_OPTIONS; + opts.storeKeysWeakly = true; + ipAddressMap = celix_stringHashMap_createWithOptions(&opts); + if (ipAddressMap == NULL) { + celix_logHelper_logTssErrors(rsa->loghelper, CELIX_LOG_LEVEL_ERROR); + celix_logHelper_error(rsa->loghelper, "Error creating ip address map"); + return CELIX_ENOMEM; + } + ipStrListCopy = celix_utils_strdup(ipaddresses); + if (ipStrListCopy == NULL) { + return CELIX_ENOMEM; + } + char *savePtr = NULL; + char *token = strtok_r(ipStrListCopy, ",", &savePtr); + while (token != NULL) { + char *ip = celix_utils_trimInPlace(token); Review Comment: Does it mean that each time we perform an RPC, we need to do these `strdup` `strtok_r` `inet_pton` things? It sounds bad. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@celix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org