Boost logo

Boost :

From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2021-08-25 10:23:21


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.

PS: Please, don't top-post.

> On Wed, 25 Aug 2021 at 08:30, sandeep m.v <venkata.sandeep.m_at_[hidden]>
> wrote:
>
>> Thank you for the response.
>>
>> We build our application for multiple platforms, Windows, Linux, Android
>> and iOS.
>> If it is not possible to cancel, is there a way to close internal socket,
>> so that it wont callback resolve handler?
>> By that way, we can at least go ahead with our processing after our
>> internal timeout assuming callback never happen later.
>> Is that something possible?
>>
>>
>>
>> On Wed, Aug 25, 2021 at 1:29 AM Richard Hodges via Boost <
>> boost_at_[hidden]> wrote:
>>
>>> On Linux async_resolve is currently implemented in terms of a spawned
>>> thread which calls a synchronous function. It has a 30s timeout and can’t
>>> be cancelled.
>>>
>>> On Tue, 24 Aug 2021 at 21:56, Vinnie Falco via Boost <
>>> boost_at_[hidden]>
>>> wrote:
>>>
>>>> On Tue, Aug 24, 2021 at 12:09 PM sandeep m.v via Boost
>>>> <boost_at_[hidden]> wrote:
>>>>> Can someone please help me with this?
>>>>
>>>> Are you by chance using Windows? What version?
>>>>
>>>> Thanks
>>>>
>>>> _______________________________________________
>>>> Unsubscribe & other changes:
>>>> http://lists.boost.org/mailman/listinfo.cgi/boost
>>>>
>>> --
>>> Richard Hodges
>>> hodges.r_at_[hidden]
>>> office: +44 2032 898 513
>>> home: +376 861 195
>>> mobile: +376 380 212
>>>
>>> _______________________________________________
>>> Unsubscribe & other changes:
>>> http://lists.boost.org/mailman/listinfo.cgi/boost
>>>
>>
>>
>> --
>> Regards,
>> Sandeep
>> Mob# 9000707098
>>
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk