Permalink
Browse files

Update xbmc/network/DNSNameCache.cpp

  • Loading branch information...
1 parent e15269b commit 8fb47a52202949f3ba1e7d8e8e9332a490b3cbf7 @odon odon committed Jul 30, 2012
Showing with 9 additions and 9 deletions.
  1. +9 −9 xbmc/network/DNSNameCache.cpp
@@ -51,6 +51,15 @@ bool CDNSNameCache::Lookup(const CStdString& strHostName, CStdString& strIpAddre
if(g_DNSCache.GetCached(strHostName, strIpAddress))
return true;
+ // perform dns lookup
+ struct hostent *host = gethostbyname(strHostName.c_str());
+ if (host && host->h_addr_list[0])
+ {
+ strIpAddress.Format("%d.%d.%d.%d", (unsigned char)host->h_addr_list[0][0], (unsigned char)host->h_addr_list[0][1], (unsigned char)host->h_addr_list[0][2], (unsigned char)host->h_addr_list[0][3]);
+ g_DNSCache.Add(strHostName, strIpAddress);
+ return true;
+ }
+
#ifndef _WIN32
// perform netbios lookup (win32 is handling this via gethostbyname)
char nmb_ip[100];
@@ -78,15 +87,6 @@ bool CDNSNameCache::Lookup(const CStdString& strHostName, CStdString& strIpAddre
}
#endif
- // perform dns lookup
- struct hostent *host = gethostbyname(strHostName.c_str());
- if (host && host->h_addr_list[0])
- {
- strIpAddress.Format("%d.%d.%d.%d", (unsigned char)host->h_addr_list[0][0], (unsigned char)host->h_addr_list[0][1], (unsigned char)host->h_addr_list[0][2], (unsigned char)host->h_addr_list[0][3]);
- g_DNSCache.Add(strHostName, strIpAddress);
- return true;
- }
-
CLog::Log(LOGERROR, "Unable to lookup host: '%s'", strHostName.c_str());
return false;
}

0 comments on commit 8fb47a5

Please sign in to comment.