xuzhenbao commented on code in PR #470: URL: https://github.com/apache/celix/pull/470#discussion_r1378321550
########## bundles/remote_services/discovery_zeroconf/src/discovery_zeroconf_announcer.c: ########## @@ -425,6 +424,7 @@ static void discoveryZeroconfAnnouncer_announceEndpoints(discovery_zeroconf_anno break; } TXTRecordDeallocate(&txtRecord); + celix_propertiesIterator_next(&propIter); Review Comment: I think `discoveryZeroconfAnnouncer_copyPropertiesToTxtRecord` also should be invoked before `while (!celix_propertiesIterator_isEnd(&propIter))` . otherwise, a same property is set in `txtRecord`. We can resolve it in another way: Only let `discoveryZeroconfAnnouncer_copyPropertiesToTxtRecord` do `celix_propertiesIterator_next` whether txtRecord is filled or not. ~~~ static bool discoveryZeroconfAnnouncer_copyPropertiesToTxtRecord(discovery_zeroconf_announcer_t *announcer, celix_properties_iterator_t *propIter, TXTRecordRef *txtRecord, uint16_t maxTxtLen, bool splitTxtRecord) { const char *key; const char *val; while (!celix_propertiesIterator_isEnd(propIter)) { key = propIter->key; val = propIter->entry.value; if (key) { DNSServiceErrorType err = TXTRecordSetValue(txtRecord, key, strlen(val), val); if (err != kDNSServiceErr_NoError) { celix_logHelper_error(announcer->logHelper, "Announcer: Failed to set txt value, %d.", err); return false; } if (splitTxtRecord && TXTRecordGetLength(txtRecord) >= maxTxtLen - UINT8_MAX) { celix_propertiesIterator_next(propIter); break; } } celix_propertiesIterator_next(propIter); } return true; } ~~~ -- 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