Skip to content

Commit 6766be6

Browse files
authored
Merge pull request #618 from david-cermak/feat/mdns_console_host_more_tests
[mdns]: More console tests
2 parents e425a3c + 1e8ede3 commit 6766be6

File tree

5 files changed

+535
-18
lines changed

5 files changed

+535
-18
lines changed

components/mdns/mdns.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6079,7 +6079,7 @@ esp_err_t mdns_instance_name_set(const char *instance)
60796079
esp_err_t mdns_service_add_for_host(const char *instance, const char *service, const char *proto, const char *hostname,
60806080
uint16_t port, mdns_txt_item_t txt[], size_t num_items)
60816081
{
6082-
if (!_mdns_server || _str_null_or_empty(service) || _str_null_or_empty(proto) || !port || !hostname) {
6082+
if (!_mdns_server || _str_null_or_empty(service) || _str_null_or_empty(proto) || !port || !_mdns_server->hostname) {
60836083
return ESP_ERR_INVALID_ARG;
60846084
}
60856085

@@ -6089,6 +6089,10 @@ esp_err_t mdns_service_add_for_host(const char *instance, const char *service, c
60896089
return ESP_ERR_NO_MEM;
60906090
}
60916091

6092+
if (!hostname) {
6093+
hostname = _mdns_server->hostname;
6094+
}
6095+
60926096
mdns_srv_item_t *item = _mdns_get_service_item_instance(instance, service, proto, hostname);
60936097
MDNS_SERVICE_UNLOCK();
60946098
if (item) {

0 commit comments

Comments
 (0)