Draft: Add attach/detach for the dns_dispatch_send() [v9.18]
requested to merge 3105-assertion-failure-on-shutdown-in-req_senddone-3184-query-context-management-issues-in-dighost-c-v9_18 into v9_18
The order in which the netievents are processed on the network manager loop is not guaranteed. Therefore the recv/read callback can come earlier than the send/write callback.
The dns_request API wasn't ready for this reordering and it was destroying the dns_request_t object before the send callback has been called.
Add additional attach/detach in the req_send()/req_senddone() functions to make sure we don't destroy the dns_request_t while it's still being references by asynchronous call.
(cherry picked from commit f3ca90a8)
Closes #3105 (closed)
Edited by Ondřej Surý