mirror of https://github.com/koreader/koreader
NetworkMgr: Use cheaper/simpler hasDefaultRoute in isOnline
Device:getDefaultRoute parses /proc/net/route and converts the hex addresses to textual IP addresses, but in `isOnline` we don't care what address the gateway actually has, we only care about whether we have a default route into the Internet. This provides a simpler alternative that does the equivalent of "ip route get 1.1.1.1" and returns true if we have a route. It's also much easier to extend this for IPv6-only networks, although that isn't implemented yet (PocketBook has no IPv6 support).reviewable/pr11601/r1
parent
9b94ebb548
commit
30a490bb11
Loading…
Reference in New Issue