feat(mdns): Console test for add/remove delegated service APIs

This commit is contained in:
David Cermak
2024-07-22 12:34:03 +02:00
parent ce7f326af0
commit 43de7e5c4d
3 changed files with 51 additions and 4 deletions

View File

@ -6079,7 +6079,7 @@ esp_err_t mdns_instance_name_set(const char *instance)
esp_err_t mdns_service_add_for_host(const char *instance, const char *service, const char *proto, const char *hostname,
uint16_t port, mdns_txt_item_t txt[], size_t num_items)
{
if (!_mdns_server || _str_null_or_empty(service) || _str_null_or_empty(proto) || !port || !hostname) {
if (!_mdns_server || _str_null_or_empty(service) || _str_null_or_empty(proto) || !port || !_mdns_server->hostname) {
return ESP_ERR_INVALID_ARG;
}
@ -6089,6 +6089,10 @@ esp_err_t mdns_service_add_for_host(const char *instance, const char *service, c
return ESP_ERR_NO_MEM;
}
if (!hostname) {
hostname = _mdns_server->hostname;
}
mdns_srv_item_t *item = _mdns_get_service_item_instance(instance, service, proto, hostname);
MDNS_SERVICE_UNLOCK();
if (item) {