mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-09-13 08:29:32 +02:00
debugging getHostByName
This commit is contained in:
+24
-4
@@ -399,13 +399,33 @@ void setDisabledPalette(QWidget *w)
|
|||||||
|
|
||||||
QString getAddrByName(const QString &name, int af_type)
|
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
|
try
|
||||||
{
|
{
|
||||||
list<InetAddr> results = DNS::getHostByName(
|
results = DNS::getHostByName(name.toAscii().constData(), af_type);
|
||||||
name.toAscii().data(), af_type);
|
} catch (FWException &e)
|
||||||
return QString(results.front().toString().c_str());
|
|
||||||
} catch (FWException&)
|
|
||||||
{
|
{
|
||||||
|
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 "";
|
return "";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user