No timeout for dns host name lookup
Describe the bug I set the timeout as usual but in a scenario when the network is connected but the internet is not available to complete a DNS lookup, there are no callbacks for a quite amount of time. How do we handle this?
I am using ReactiveNetwork.checkInternetConnectivity().
To Reproduce Steps to reproduce the behavior:
- Connect to a wifi source which doesn't have a working connection.
- Start the app and observe.
Thanks for reporting that. I'm not really sure how to handle this particular use case. Probably I'll need more time for analysing that.
I am not sure just guessing. It's just what others are saying.
Inside isConnected(),
- First we check the address
InetAddress.getByName()from hostname. - Use the above in a thread and terminate that thread after the desired timeout (by user). If the timeout has been reached, send an error callback else to proceed.
- Supply that
InetAddressto theURLclass instead of the original hostname (by user). So no extra lookups.
What are your thoughts?
Use the above in a thread and terminate that thread after the desired timeout (by user)
Obviously @pwittchen leave a default of like 5 secs