[Pkg-owncloud-commits] [owncloud-client] 07/159: Windows: Reset QNAM as a workaround. #2899 #2895 #2973
Sandro Knauß
hefee-guest at moszumanska.debian.org
Fri May 1 13:05:15 UTC 2015
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit 57c14a0ebab56c322fe2b42e33e557cc42a70781
Author: Christian Kamm <kamm at incasoftware.de>
Date: Thu Mar 19 11:40:47 2015 +0100
Windows: Reset QNAM as a workaround. #2899 #2895 #2973
The QNetworkAccessManager is reset when we are disconnected, just
before attempting to fetch the server's status.php.
This may help fix the problem described in various issues where we
get 'Connection closed' or timeout errors after the OS has woken
from sleep.
---
src/gui/accountstate.cpp | 9 +++++++++
src/libsync/account.cpp | 15 +++++++++++++++
src/libsync/account.h | 1 +
3 files changed, 25 insertions(+)
diff --git a/src/gui/accountstate.cpp b/src/gui/accountstate.cpp
index 600650f..289717f 100644
--- a/src/gui/accountstate.cpp
+++ b/src/gui/accountstate.cpp
@@ -179,6 +179,15 @@ void AccountState::checkConnectivity()
conValidator->checkAuthentication();
} else {
// Check the server and then the auth.
+
+#ifdef Q_OS_WIN
+ // There seems to be a bug in Qt on Windows where QNAM sometimes stops
+ // working correctly after the computer woke up from sleep. See #2895 #2899
+ // and #2973.
+ // As an attempted workaround, reset the QNAM regularly if the account is
+ // disconnected.
+ account()->resetNetworkAccessManager();
+#endif
conValidator->checkServerAndAuth();
}
}
diff --git a/src/libsync/account.cpp b/src/libsync/account.cpp
index 5d2db34..990b482 100644
--- a/src/libsync/account.cpp
+++ b/src/libsync/account.cpp
@@ -271,6 +271,21 @@ void Account::clearCookieJar()
_am->setCookieJar(new CookieJar);
}
+void Account::resetNetworkAccessManager()
+{
+ if (!_credentials || !_am) {
+ return;
+ }
+
+ qDebug() << "Resetting QNAM";
+ QNetworkCookieJar* jar = _am->cookieJar();
+ _am->deleteLater();
+ _am = _credentials->getQNAM();
+ _am->setCookieJar(jar); // takes ownership of the old cookie jar
+ connect(_am, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)),
+ SLOT(slotHandleErrors(QNetworkReply*,QList<QSslError>)));
+}
+
QNetworkAccessManager *Account::networkAccessManager()
{
return _am;
diff --git a/src/libsync/account.h b/src/libsync/account.h
index 1397195..3d8604f 100644
--- a/src/libsync/account.h
+++ b/src/libsync/account.h
@@ -156,6 +156,7 @@ public:
void clearCookieJar();
+ void resetNetworkAccessManager();
QNetworkAccessManager* networkAccessManager();
/// Called by network jobs on credential errors.
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list