-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[mDNS] ESP32C3 mDNS remove after a few minutes (IDFGH-6263) #7932
Comments
At what priority are you running the mDNS query task? mDNS task itself runs at a default of priority 1 (same as app_main). Since the C3 is a single core chip it is possible the mDNS query task is running at a higher priority than the mDNS task leading to the delays. |
Hi @edieruby I confirm that it could be a problem to repeatably query ( The problem is quite hard to explain and harder to fix.
There're multiple ways to address this issue, from updating the docs and educating users to sending one-shot queries. The most easy seems to be using unicast diff --git a/components/mdns/mdns.c b/components/mdns/mdns.c
index 4240a1a787f..931aa9f579b 100644
--- a/components/mdns/mdns.c
+++ b/components/mdns/mdns.c
@@ -3682,7 +3682,7 @@ static mdns_tx_packet_t * _mdns_create_search_packet(mdns_search_once_t * search
return NULL;
}
q->next = NULL;
- q->unicast = search->type != MDNS_TYPE_PTR;
+ q->unicast = 1;
q->type = search->type;
q->host = search->instance;
q->service = search->service; |
@david-cermak I will try it. I want to multiple ESP32-C3s to connect each other by TCP. I uploaded my test code above already. confused that why it will affect publish its own mDNS service. |
change the task priority , same problem. I will do more test. |
Please read this chapter https://datatracker.ietf.org/doc/html/rfc6762#section-5.2 So I think if you simply change the query type to unicast and let it run less frequently it should solve your issue.
Have you tested the unicast change? It should prevent from removing the service even if you query without any delay. |
Not yet. |
It works. |
works. Thanks! |
Adresses espressif/esp-idf#7932 * Original commit: espressif/esp-idf@7eeeb01
Adresses espressif/esp-idf#7932 * Original commit: espressif/esp-idf@7eeeb01
Adresses espressif/esp-idf#7932 * Original commit: espressif/esp-idf@7eeeb01
Adresses espressif/esp-idf#7932 * Original commit: espressif/esp-idf@7eeeb01
Adresses espressif/esp-idf#7932 * Original commit: espressif/esp-idf@7eeeb01
Adresses espressif/esp-idf#7932 * Original commit: espressif/esp-idf@7eeeb01
Adresses espressif/esp-idf#7932 * Original commit: espressif/esp-idf@7eeeb01
Adresses espressif/esp-idf#7932 * Original commit: espressif/esp-idf@7eeeb01
Adresses espressif/esp-idf#7932 * Original commit: espressif/esp-idf@7eeeb01
I (48) boot: ESP-IDF v4.3.1-dirty 2nd stage bootloader
I (49) boot: compile time 16:03:22
I (49) boot: chip revision: 3
I (51) boot.esp32c3: SPI Speed : 80MHz
I (56) boot.esp32c3: SPI Mode : DIO
I (60) boot.esp32c3: SPI Flash Size : 4MB
based on mDNS example.
add loop query mDNS service in a task.
mDNS service itself will remove after a few minutes.
src code:
mdns.zip
static void check_button(void)
{
static bool old_level = true;
bool new_level = gpio_get_level(EXAMPLE_BUTTON_GPIO);
// if (!new_level && old_level)
{
query_mdns_service("_http", "_tcp");
}
old_level = new_level;
}
service remove:
static void check_button(void)
{
static bool old_level = true;
bool new_level = gpio_get_level(EXAMPLE_BUTTON_GPIO);
// if (!new_level && old_level)
{
// query_mdns_service("_http", "_tcp");
}
old_level = new_level;
}
when disable query mDNS service , it work well.
The text was updated successfully, but these errors were encountered: