Skip to content

Commit

Permalink
get rid of non DNS online check
Browse files Browse the repository at this point in the history
if DNS resolution doesn't work, we have a problem anyway
  • Loading branch information
wsnipex committed Mar 22, 2014
1 parent 9e9b479 commit 6d825c5
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 14 deletions.
4 changes: 0 additions & 4 deletions language/English (US)/strings.po
Expand Up @@ -4385,10 +4385,6 @@ msgctxt "#13271"
msgid "CPU Usage:"
msgstr "CPU Usage:"

msgctxt "#13274"
msgid "Connected, but no DNS is available."
msgstr "Connected, but no DNS is available."

msgctxt "#13275"
msgid "Hard Disk"
msgstr "Hard Disk"
Expand Down
5 changes: 1 addition & 4 deletions xbmc/filesystem/CurlFile.cpp
Expand Up @@ -868,12 +868,9 @@ bool CCurlFile::Download(const CStdString& strURL, const CStdString& strFileName
}

// Detect whether we are "online" or not! Very simple and dirty!
bool CCurlFile::IsInternet(bool checkDNS /* = true */)
bool CCurlFile::IsInternet()
{
CStdString strURL = "http://www.google.com";
if (!checkDNS)
strURL = "http://74.125.19.103"; // www.google.com ip

bool found = Exists(strURL);
Close();

Expand Down
2 changes: 1 addition & 1 deletion xbmc/filesystem/CurlFile.h
Expand Up @@ -67,7 +67,7 @@ namespace XFILE
bool Get(const CStdString& strURL, CStdString& strHTML);
bool ReadData(CStdString& strHTML);
bool Download(const CStdString& strURL, const CStdString& strFileName, LPDWORD pdwSize = NULL);
bool IsInternet(bool checkDNS = true);
bool IsInternet();
void Cancel();
void Reset();
void SetUserAgent(CStdString sUserAgent) { m_userAgent = sUserAgent; }
Expand Down
4 changes: 0 additions & 4 deletions xbmc/utils/SystemInfo.cpp
Expand Up @@ -99,8 +99,6 @@ CSysData::INTERNET_STATE CSysInfoJob::GetInternetState()
XFILE::CCurlFile http;
if (http.IsInternet())
return CSysData::CONNECTED;
if (http.IsInternet(false))
return CSysData::NO_DNS;
return CSysData::DISCONNECTED;
}

Expand Down Expand Up @@ -207,8 +205,6 @@ CStdString CSysInfo::TranslateInfo(int info) const
case SYSTEM_INTERNET_STATE:
if (m_info.internetState == CSysData::CONNECTED)
return g_localizeStrings.Get(13296);
else if (m_info.internetState == CSysData::NO_DNS)
return g_localizeStrings.Get(13274);
else
return g_localizeStrings.Get(13297);
case SYSTEM_BATTERY_LEVEL:
Expand Down
2 changes: 1 addition & 1 deletion xbmc/utils/SystemInfo.h
Expand Up @@ -35,7 +35,7 @@
class CSysData
{
public:
enum INTERNET_STATE { UNKNOWN, CONNECTED, NO_DNS, DISCONNECTED };
enum INTERNET_STATE { UNKNOWN, CONNECTED, DISCONNECTED };
CSysData()
{
Reset();
Expand Down

0 comments on commit 6d825c5

Please sign in to comment.