Skip to content

Conversation

r10s
Copy link
Contributor

@r10s r10s commented Nov 29, 2021

switching completely to /etc/resolv.conf (see #2780)
does not work at least on some Androids
(see deltachat/deltachat-android#2151 )

therefore, we use the old approach as a fallback.

fixes deltachat/deltachat-android#2151

@link2xt i am not deep in that stuff, maybe there is a more elegant solution or sth. to tweak upstream, however, this one works :) (tested on android)

for review: the fix is in the first commit, the second one only adds a warning - and introduces some noise as we have to pass context around.

@r10s r10s requested a review from link2xt November 29, 2021 23:03
switching completely to /etc/resolv.conf (see #2780)
does not work at least on some Androids
(see deltachat/deltachat-android#2151 )

therefore, we use the old approach as a fallback.
/// This does not work at least on some Androids, therefore we use use ResolverConfig::default()
/// which default eg. to google's 8.8.8.8 or 8.8.4.4 as a fallback.
async fn get_resolver() -> Result<AsyncStdResolver, ResolveError> {
if let Ok(resolver) = resolver_from_system_conf().await {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log the error here?

/// We first try resolver_from_system_conf() which reads the system's resolver from `/etc/resolv.conf`.
/// This does not work at least on some Androids, therefore we use use ResolverConfig::default()
/// which default eg. to google's 8.8.8.8 or 8.8.4.4 as a fallback.
async fn get_resolver() -> Result<AsyncStdResolver, ResolveError> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's ok to simply import anyhow::Result at the top of the module rather than the test and return it here, so anyhow::Result is used as much as possible, preferrably across the whole crate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i also first tried that, getting "expected struct anyhow::Error, found struct ResolveError" - so i assumed i have to convert the object somehow and did not want to dive into that yesterday :)

Copy link
Collaborator

@link2xt link2xt Nov 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like

let resolver = ...?;
Ok(resolver)

? will convert the Result automatically.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's clever! i did not thought too much about these conversions in the past :)

i did a successor pr that uses map_err() at #2853 - but you would prefer the one above?

@r10s r10s merged commit fee08f0 into master Nov 30, 2021
@r10s r10s deleted the fix-gapps-oauth2 branch November 30, 2021 10:23
@link2xt
Copy link
Collaborator

link2xt commented Nov 30, 2021

Related issue in the upstream crate: https://github.com/bluejekyll/trust-dns/issues/652

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Login with Google Workspace on a .net domain results in invalid email

2 participants