From 5cb511f025736d32742674e21233f753d7679ac3 Mon Sep 17 00:00:00 2001 From: SVN User Date: Thu, 17 Jul 2008 19:12:46 +0000 Subject: [PATCH] debugging getHostByName --- build_num | 2 +- src/gui/utils.cpp | 28 ++++++++++++++++++++++++---- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/build_num b/build_num index 4c2d46832..75aee55bf 100644 --- a/build_num +++ b/build_num @@ -1 +1 @@ -#define BUILD_NUM 372 +#define BUILD_NUM 374 diff --git a/src/gui/utils.cpp b/src/gui/utils.cpp index 268f32889..dae402b41 100644 --- a/src/gui/utils.cpp +++ b/src/gui/utils.cpp @@ -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 results; try { - list 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 "";