data_connection_checker
data_connection_checker copied to clipboard
Modify testing logic to immediately return if any of the simultaneous pings succeed
Currently the logic is "All addresses are pinged simultaneously. ... When all the requests complete with either success or failure, a check is made to see if the list contains at least one true boolean.". However if any of the hosts slow to respond (for example for some reason CloudFlare DNSes don't respond (https://github.com/komapeb/data_connection_checker/issues/10#issuecomment-736704451) then we have to wait a timeout (10 seconds). In my opinion if any of the pings succeed then the test could already cut short any other pings and return immediately.
I made a PR https://github.com/komapeb/data_connection_checker/pull/24#issue-1018609997
There is however a breaking changes regarding the lastTryResults
variable.
If you want to use my fix before it gets merged in this project, you can use my fork, you just have to paste this in your pubspec.yaml
:
data_connection_checker:
git:
url: https://github.com/Daplex/data_connection_checker.git
ref: 633f3254d2c407c4af95035997cca5b2c93dbbc2