AccessManager: don't set an invalid network configuration on linux (#5538)
authorOlivier Goffart <olivier@woboq.com>
Thu, 16 Feb 2017 15:14:55 +0000 (16:14 +0100)
committerMarkus Goetz <markus@woboq.com>
Thu, 16 Feb 2017 15:14:55 +0000 (16:14 +0100)
If we call
 setConfiguration(QNetworkConfiguration());
This sets an invalid configuration on the QNAM.
But later, when we really go online because interfaces are discovered,
QNetworkAccessManagerPrivate::_q_onlineStateChanged is called (with isOnline=true).
And this will set the state to disconnected because customNetworkConfiguration is
true, and the networkConfiguration state is disabled.

The workaround we to fix another bug on Windows in which the default network
configuration was not behaving properly.

The issue on linux is hard to reproduce and only happen in some condition,
but it was reproduced on smashbox when they run two owncloudcmd at the same time.

Issues: #4720 , #3600

src/libsync/accessmanager.cpp

index f8730e98869c423ac18b22dfb2cb23f9bf7970cc..fe4258a033f6fc3354b1c1590db7cf40f20f33ee 100644 (file)
@@ -37,8 +37,11 @@ AccessManager::AccessManager(QObject* parent)
     proxy.setHostName(" ");
     setProxy(proxy);
 #endif
+
+#ifndef Q_OS_LINUX
     // Atempt to workaround for https://github.com/owncloud/client/issues/3969
     setConfiguration(QNetworkConfiguration());
+#endif
     setCookieJar(new CookieJar);
 }