Skip to content

Commit

Permalink
Merge pull request #618 from david-cermak/feat/mdns_console_host_more…
Browse files Browse the repository at this point in the history
…_tests

[mdns]: More console tests
  • Loading branch information
david-cermak authored Aug 16, 2024
2 parents e425a3c + 1e8ede3 commit 6766be6
Show file tree
Hide file tree
Showing 5 changed files with 535 additions and 18 deletions.
6 changes: 5 additions & 1 deletion components/mdns/mdns.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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) {
Expand Down
Loading

0 comments on commit 6766be6

Please sign in to comment.