From c2b6e1ce1aa402b143d0154748c518a87bc6424a Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Sun, 27 Mar 2016 22:53:40 +0300 Subject: [PATCH] Fix periodic latency spikes on Windows with WiFi connections. Closes #4209. --- src/app/main.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/app/main.cpp b/src/app/main.cpp index 949de23cf..f4848f408 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -215,6 +215,21 @@ int main(int argc, char *argv[]) return EXIT_SUCCESS; } +#if defined(Q_OS_WIN) && defined(QBT_USES_QT5) + // This affects only Windows apparently and Qt5. + // When QNetworkAccessManager is instantiated it regularly starts polling + // the network interfaces to see what's available and their status. + // This polling creates jitter and high ping with wifi interfaces. + // So here we disable it for lack of better measure. + // It will also spew this message in the console: QObject::startTimer: Timers cannot have negative intervals + // For more info see: + // 1. https://github.com/qbittorrent/qBittorrent/issues/4209 + // 2. https://bugreports.qt.io/browse/QTBUG-40332 + // 3. https://bugreports.qt.io/browse/QTBUG-46015 + + qputenv("QT_BEARER_POLL_TIMEOUT", QByteArray::number(-1)); +#endif + #ifndef DISABLE_GUI if (!upgrade()) return EXIT_FAILURE; #else