ReactiveNetwork icon indicating copy to clipboard operation
ReactiveNetwork copied to clipboard

No timeout for dns host name lookup

Open foodied opened this issue 6 years ago • 3 comments

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:

  1. Connect to a wifi source which doesn't have a working connection.
  2. Start the app and observe.

foodied avatar Mar 18 '19 13:03 foodied

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.

pwittchen avatar Mar 18 '19 14:03 pwittchen

I am not sure just guessing. It's just what others are saying.

Inside isConnected(),

  1. First we check the address InetAddress.getByName() from hostname.
  2. 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.
  3. Supply that InetAddress to the URL class instead of the original hostname (by user). So no extra lookups.

What are your thoughts?

foodied avatar Mar 18 '19 14:03 foodied

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

Polyterative avatar Mar 21 '19 08:03 Polyterative