debugging getHostByName

This commit is contained in:
SVN User
2008-07-17 19:12:46 +00:00
parent 6a2160f663
commit 5cb511f025
2 changed files with 25 additions and 5 deletions
+1 -1
View File
@@ -1 +1 @@
#define BUILD_NUM 372
#define BUILD_NUM 374
+24 -4
View File
@@ -399,13 +399,33 @@ void setDisabledPalette(QWidget *w)
QString getAddrByName(const QString &name, int af_type)
{
if (fwbdebug)
qDebug("DNS::getAddrByName: start lookup for %s, af %d",
name.toAscii().constData(), af_type);
list<InetAddr> results;
try
{
list<InetAddr> results = DNS::getHostByName(
name.toAscii().data(), af_type);
return QString(results.front().toString().c_str());
} catch (FWException&)
results = DNS::getHostByName(name.toAscii().constData(), af_type);
} catch (FWException &e)
{
if (fwbdebug)
qDebug("DNS::getAddrByName: DNS lookup error: %s", e.toString());
return "";
}
if (fwbdebug)
{
qDebug("DNS::getAddrByName: got %d addresses", results.size());
}
try
{
if (results.size()>0)
return QString(results.front().toString().c_str());
} catch (FWException &e)
{
qDebug("DNS::getAddrByName: Can not convert address to string");
}
return "";