Skip to content

Commit

Permalink
Make online detection a bit smarter (bug 1730)
Browse files Browse the repository at this point in the history
If we don't have "ifconfig" and "ip" assume we're online
(because we can't determine that we're offline), and if
detecting the network connection fails for some reason,
also assume that we're online. This avoid bogus "you're
offline" messages while still giving good feedback to
users who try to check for new episodes while offline.
  • Loading branch information
thp committed Jan 29, 2013
1 parent 85ab38a commit 72c028d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/gpodder/util.py
Expand Up @@ -1706,15 +1706,21 @@ def connection_available():
elif gpodder.ui.osx:
return len(list(osx_get_active_interfaces())) > 0
else:
if len(list(unix_get_active_interfaces())) > 0:
if (find_command('ifconfig') is not None and
len(list(unix_get_active_interfaces())) > 0):
return True
elif len(list(linux_get_active_interfaces())) > 0:
elif (find_command('ip') is not None and
len(list(linux_get_active_interfaces())) > 0):
return True
else:
# If we have neither "ifconfig" nor "ip", assume we're online (bug 1730)
return True

return False
except Exception, e:
logger.warn('Cannot get connection status: %s', e, exc_info=True)
return False
# When we can't determine the connection status, act as if we're online (bug 1730)
return True


def website_reachable(url):
Expand Down

0 comments on commit 72c028d

Please sign in to comment.