On Fri, Nov 4, 2016 at 5:02 PM, Rick Stevens <[email protected]> wrote:
> On 11/04/2016 12:58 PM, Michael B Allen wrote:
>> I never understood these logical meta languages. Pam is another
>> example. It's basically just an obscure way of writing code so it's
>> not obvious to me why this isn't just scripted so that someone has the
>> option of making them work together (call both mDNS and DNS async and
>> then return first to respond).
>
> Historically, host resolution has never been a multithreaded process
> so it's never been done async (the API has no non-blocking versions
> of the function calls).

You don't need multithreading to do async. The resolver calls would
take a parameter that indicates that the call should return right away
vs timeout. So in this case it could call the mDNS routine which would
return right away, then call the DNS routine which would also return
right away and then call mDNS again with a 1s timeout and loop on that
3 times as necessary until you get a reasonable answer.

I would be surprised if the resolver code doesn't do async like this
already. I write networking code for a living BTW.

> Where both mDNS and real DNS are active, if you parallelize the queries
> as you suggesting and get different answers, which answer gets
> credence?

Whichever looks better. This is why it should be scripted instead of
using nsswitch which tries to parameterize everything.

> mDNS will almost always answer first since it's local to your
> machine so DNS would never be consulted and you'd just get "not found"
> out the wazoo.

If it's a negative response (as opposed to no response) then you keep
going until you get a reasonable answer or times out.

Mike
_______________________________________________
users mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to