[haiku-development] Re: Plan for NetServices Kit (v2)
- From: "Andrew Lindesay" <apl@xxxxxxxxxxxxxx>
- To: haiku-development@xxxxxxxxxxxxx
- Date: Tue, 31 Aug 2021 21:59:45 +1200
I am hoping for some insights and discussion.
Hello Niels;
Thank you for working on this proposal.
One thing that is problematic in HaikuDepot is cancelling HTTP requests because
the as-built `BNetworkRequest::_ResolveHostName` uses the blocking
`getaddrinfo` and so the cancel doesn't work if it blocks on the name
resolution on the caller thread. I have read that libcurl provides a mechanism
for the user to provide a plug-able name lookup mechanism in so there is an
option to run `getaddrinfo` in another thread, but that's still not awesome.
I'm not sure if there's an obvious solution here, but this problem would be
worth considering in the design; can we transparently cancel the URL requests
if they are still doing DNS lookups somehow?
I would also like to voice some concern about the newer C++ features coming in
for things like errors, collections and references. I don't explicitly object,
but I think this needs to be done carefully and cohesively in a strategy for
all public interfaces on the platform.
The "classic" code of HakuDepot returning `status_t` and the exception-throwing
code of the PackageKit are rather odd together and I sometimes wonder if it
would have been better one way or the other but not both. The idea of
introducing a third way seems like it will really cause some confusion. The
easiest thing would be to stick with the old way returning `status_t` because
it will cause less change and less work. If it is going to be changed however,
it need to be coupled with an all-of-platform strategy around this.
Regards.
Other related posts: