Skip to content

Remove DNS handling from all C modules except net.dns. #3063

@nwf

Description

@nwf

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, using wait_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 a tls socket while a DNS operation is in progress.

  • mqtt and websocket 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions