From 9a0d25284cb282f79f72a2a8cea09d66e33ba2e3 Mon Sep 17 00:00:00 2001 From: Eugene Shalygin Date: Tue, 24 May 2016 00:27:53 +0200 Subject: [PATCH] Add a workaround for QTBUG-52633, qBt issue #5073 The QTBUG-52633 results in food of network interface changed events, libtorrent IP rebind calls and flood in the qBt log. The work around is the check not only for interface name, but for IP address on that interface before triggering the libtorrent rebind. --- src/base/bittorrent/session.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/base/bittorrent/session.cpp b/src/base/bittorrent/session.cpp index 3504e30a8..faf7fffe9 100644 --- a/src/base/bittorrent/session.cpp +++ b/src/base/bittorrent/session.cpp @@ -1935,7 +1935,17 @@ void Session::networkConfigurationChange(const QNetworkConfiguration& cfg) if (configuredInterfaceName.isEmpty()) return; const QString changedInterface = cfg.name(); + + // workaround for QTBUG-52633: check interface IPs, react only if the IPs have changed + // seems to be present only with NetworkManager, hence Q_OS_LINUX +#if defined Q_OS_LINUX && QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) // && QT_VERSION <= QT_VERSION_CHECK(5, ?, ?) + static QStringList boundIPs = getListeningIPs(); + const QStringList newBoundIPs = getListeningIPs(); + if ((configuredInterfaceName == changedInterface) && (boundIPs != newBoundIPs)) { + boundIPs = newBoundIPs; +#else if (configuredInterfaceName == changedInterface) { +#endif Logger::instance()->addMessage(tr("Network configuration of %1 has changed, refreshing session binding", "e.g: Network configuration of tun0 has changed, refreshing session binding").arg(changedInterface), Log::INFO); configureListeningInterface(); }