-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Lets changes our OkHttp 5 async DNS APIs #8318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I’d also really like for OkHttp to do async internally when that’s possible. I expect that to be a difficult refactor. |
Maybe we should list and prioritise those and work towards them being pragmatically async when it is obviously an improvement. Some are hard like interceptors. Some might be easier like cache. |
I'm taking a look at this as part of #8286 (comment) |
Cleanly pinning network on Android - square#8286 Redo the Async DNS API, but internal for now - square#8318
More riffing on this API... I want a way to cancel all long-running operations. Canceling a regular OkHttp
I think we also might want to differentiate between a successful but empty result and a connectivity failure. Right now DNS always returns a non-empty list or a failure, and that makes it difficult to differentiate these two logically-distinct cases. |
It isn't used anywhere yet. I want to get back to this soon but I don't want to release 5.0.0 final with any incomplete APIs. #8318
It isn't used anywhere yet. I want to get back to this soon but I don't want to release 5.0.0 final with any incomplete APIs. #8318
Our implementation is great but I’ve got some ideas for changes to the APIs.
We should support multiple rounds of responses from a single
AsyncDns
instance. This should make it easier to make a compound IPv4 + IPv6 resolver that doesn’t make the caller wait until both are done.I’m anticipating
FastFallbackExchangeFinder
as the user of this API. It could act as soon as either address class is returned.Callback to Blocking
The
toDns()
API does both callback-to-blocking and also unioning. Let’s split those responsibilities!Union Callbacks
Android API v1
By making that complex API above we can union IPv4 + IPv6 for Android users.
Android API v2
Even better than an easier-to-use API is no API at all!
Let’s change
OkHttpClient
to use Android’sDnsResolver
when that’s available? We could probably make it so ourAndroidAsyncDns
is an implementation detail that nobody needs to see.The text was updated successfully, but these errors were encountered: