|
Boost : |
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2021-08-25 10:26:53
On 8/25/21 1:23 PM, Andrey Semashev wrote:
> On 8/25/21 11:27 AM, Richard Hodges via Boost wrote:
>> There are a couple of convoluted ways to build cancellation into the
>> linux
>> resolve() activity.
>> The problem is that the sockets and timers used for this are entirely
>> embedded in the OS-shipped library layer and not accessible to user code.
>> It's a bit of a mess that has never been cleaned up. There isn't much
>> that
>> Asio can do about it.
>>
>> At present the "cleanest" way is to fork a child process to do the
>> resolve
>> call for you and async_wait on a pipe from that child. If you want to
>> cancel it, send the child a SIGKILL which will result in the wait on the
>> pipe completing with an error.
>>
>> Ghastly I know...
>
> On Linux, there is also getaddrinfo_a:
>
> https://man7.org/linux/man-pages/man3/getaddrinfo_a.3.html
>
> which allows to perform name resolution asynchronously, with
> cancellation. It's a GNU extension. I wonder if it can be incorporated
> into Boost.ASIO.
It seems, it's even been suggested before:
https://github.com/chriskohlhoff/asio/issues/449
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk