-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
This is actually an anti-feature request. Handling DNS in C is a pain and a source of object lifecycle bugs in our tree.
-
net.dns
gets it right, though the documentation asserts that there is only one callback in flight at once, which appears false. I'll add that to my next stack of cleanups. -
net
's socket handling at least tries to get it right, usingwait_dns
to continue to pin the userdata in the registry until the DNS callbacks have fired. This is entangled in its state machine, which is pretty messy. -
tls
gets it wrong, at the time of this writing, possibly referencing freed memory if the user completely drops atls
socket while a DNS operation is in progress. -
mqtt
andwebsocket
behave similarly, following pointers to possibly-dead memory.
Anyway, I'd like to simplify the C world by removing any pretense of doing DNS and require that the Lua application use net.dns
whenever DNS resolution is requisite. Note that, for example, coap
already does not support DNS, and even net
's support is restricted to TCP and not UDP.