diff options
author | Katja Marttila <katja.marttila@theqtcompany.com> | 2016-04-04 17:43:03 +0300 |
---|---|---|
committer | Katja Marttila <katja.marttila@theqtcompany.com> | 2016-04-07 04:43:52 +0000 |
commit | 80d1eb3dd7a577b92663c9bcd00f2614e9bd0a73 (patch) | |
tree | a1d8ed82df81aa4ca793ce320cc709c45b051fbd /src | |
parent | 4b652cdc1ac01390fb175889dee2e642f47aa360 (diff) |
Add a logging category and debug for http download
Sometimes installing fails due to a problem in server.
Since downloading can happen from mirror, it is hard to
detect where the problem is. Print the IP address where
the download actually happens to ease the problem solving.
Change-Id: I31e15c2b1926745c251093cd1663d1ca1c65bff6
Task-number: QTIFW-813
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/installer/globals.cpp | 5 | ||||
-rw-r--r-- | src/libs/installer/globals.h | 1 | ||||
-rw-r--r-- | src/libs/kdtools/filedownloader.cpp | 17 |
3 files changed, 21 insertions, 2 deletions
diff --git a/src/libs/installer/globals.cpp b/src/libs/installer/globals.cpp index 0f4d582ca..eb8d2641f 100644 --- a/src/libs/installer/globals.cpp +++ b/src/libs/installer/globals.cpp @@ -35,6 +35,7 @@ const char IFW_COMPONENT_CHECKER[] = "ifw.componentChecker"; const char IFW_RESOURCES[] = "ifw.resources"; const char IFW_TRANSLATIONS[] = "ifw.translations"; +const char IFW_NETWORK[] = "ifw.network"; namespace QInstaller { @@ -42,13 +43,15 @@ namespace QInstaller Q_LOGGING_CATEGORY(lcComponentChecker, IFW_COMPONENT_CHECKER) Q_LOGGING_CATEGORY(lcResources, IFW_RESOURCES) Q_LOGGING_CATEGORY(lcTranslations, IFW_TRANSLATIONS) +Q_LOGGING_CATEGORY(lcNetwork, IFW_NETWORK) QStringList loggingCategories() { static QStringList categories = QStringList() << QLatin1String(IFW_COMPONENT_CHECKER) << QLatin1String(IFW_RESOURCES) - << QLatin1String(IFW_TRANSLATIONS); + << QLatin1String(IFW_TRANSLATIONS) + << QLatin1String(IFW_NETWORK); return categories; } diff --git a/src/libs/installer/globals.h b/src/libs/installer/globals.h index e464263d4..5f92774c4 100644 --- a/src/libs/installer/globals.h +++ b/src/libs/installer/globals.h @@ -43,6 +43,7 @@ namespace QInstaller { INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcComponentChecker) INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcResources) INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcTranslations) +INSTALLER_EXPORT Q_DECLARE_LOGGING_CATEGORY(lcNetwork) QStringList INSTALLER_EXPORT loggingCategories(); diff --git a/src/libs/kdtools/filedownloader.cpp b/src/libs/kdtools/filedownloader.cpp index 508cc395d..c95eeeb94 100644 --- a/src/libs/kdtools/filedownloader.cpp +++ b/src/libs/kdtools/filedownloader.cpp @@ -51,6 +51,9 @@ #include <QSslError> #include <QBasicTimer> #include <QTimerEvent> +#include <QLoggingCategory> +#include <globals.h> +#include <QHostInfo> using namespace KDUpdater; using namespace QInstaller; @@ -1254,7 +1257,19 @@ void KDUpdater::HttpDownloader::httpReqFinished() } else { if (d->http == 0) return; - + const QUrl url = d->http->url(); + if (url.isValid() && QInstaller::lcNetwork().isDebugEnabled()){ + const QFileInfo fi(d->http->url().toString()); + if (fi.suffix() != QLatin1String("sha1")){ + const QString hostName = url.host(); + QHostInfo info = QHostInfo::fromName(hostName); + QStringList hostAddresses; + foreach (const QHostAddress &address, info.addresses()) + hostAddresses << address.toString(); + qCDebug(QInstaller::lcNetwork) << "Using host:" << hostName + << "for" << url.fileName() << "\nIP:" << hostAddresses; + } + } httpReadyRead(); d->destination->flush(); setDownloadCompleted(); |