-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Not able to set TLL in mDNS library #3338
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
Comments
In the header file is the following prototype:
Which would seem like it does what you want it to do...but I have another issue on the same lines: OTA calls MDNS.begin to put in the _arduino._tcp entries it appears that it does so with a TTL of 120 I am having problems (discussed elsewhere) with "stale" and/or duplicate records (which occur in my testing quite often - yes, my bad, I'm slack) . These "edge" cases cause my raspberry pi / NODE-RED to choke...with an "unknown dns error" Thus when I add my services AFTER OTA - I'm also getting the default TTL of 120 of course. I'd like to shorten my TTL drastically during testing. Thus I'd like a function to end MDNS. For historical reasons (I guess) the object is included "for free" when you include the library and is therefore at global scope and thus can't be "descoped" (without a reboot :) ) OR can someone reaasure me of any of the following:
In short, what is the best (recommended) way of getting a shorter TTL while not side-effecting OTA? I hope that all made sense... |
UPDATE: repeating the MDNS.begin with the shorter TTL after the OTA call seems to work. "things" appear and disappear (roughly) within the 1 minute TTL I used. I'm preceding the call with .notifyAPChange and .update and will do some more testing later as to whether these are needed. AND I may have tracked down the situation that causes the mDNS "unknown dns error" on NODE-RED: Steps to avoid / repeat:
to repeat, perform steps 1 & 2, but this time: So the error seems to occur when the device is not "pingable" but a stale / dying / unexpired service record still exists for it. I hope this helps anyone else with a similar problem! |
I'm also having issues setting the TLL. What ever I do I can't seem to make any "answers" time out and update. I "installServiceQuery" but it never seems to update. Leading to all the answers being outdated. I've looked at the source code as best as I can but can't seem to figure out whats happening with the TTL. Would really appreciate it if someone could explain how to set the TTL correctly/find out if there is a bug stopping it being set correctly. |
I am having a related issue: My device is reachable via the local domain for some time after the start, but if I keep it running, the domain expires. How to prevent that? |
@LaborEtArs do you think this line could be the source of this bug ?
|
I am having the exact same issue: My device is reachable via the local domain for some time after the start, but if I keep it running, the domain expires. Same goes for ArduinoOTA - works fine if the device is freshly started, but after running some time it wont work, device isn't discovered anymore - mDNS Explorer ( I use "Avahi Discovery") doesn't show the service anymore. How to fix this? Call .begin() again after TTL time is over? |
@Verwalter2017 @danieljharris |
There are different meanings for "Time To Live".
As @LaborEtArs says, hop is unrelated with duration (in OP). |
As @LaborEtArs explains, the paramater isn't supposed to be given by the user, and the signature is kept only for backwards compat. |
As written in the readme of the mDNS library, there should be a parameter to set the time to live (TTL) for the DNS entry:
mDNS Readme
But there is not parameter to set TLL and if you take a look at the source code, there is a constant value of
1
(shouldn't it be seconds?!).I could not find the source code for
UdpContext
, which receives this constant value. Does it receive seconds or hours?ESP8266mDNS.cpp#L2
What do you think about a method overload to define the TTL?
The text was updated successfully, but these errors were encountered: