mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
[OAuth] Fix lock
This commit is contained in:
parent
29b1eaa2fa
commit
8202eb91b2
@ -125,8 +125,18 @@ QNetworkReply *AbstractNetworkJob::addTimer(QNetworkReply *reply)
|
||||
return reply;
|
||||
}
|
||||
|
||||
bool AbstractNetworkJob::retryAble() const
|
||||
{
|
||||
return _retryAble;
|
||||
}
|
||||
|
||||
void AbstractNetworkJob::setRetryAble(bool retryAble)
|
||||
{
|
||||
_retryAble = retryAble;
|
||||
}
|
||||
|
||||
QNetworkReply *AbstractNetworkJob::sendRequest(const QByteArray &verb, const QUrl &url,
|
||||
QNetworkRequest req, QIODevice *requestBody)
|
||||
QNetworkRequest req, QIODevice *requestBody)
|
||||
{
|
||||
auto reply = _account->sendRawRequest(verb, url, req, requestBody);
|
||||
_requestBody = requestBody;
|
||||
@ -196,7 +206,7 @@ void AbstractNetworkJob::slotFinished()
|
||||
|
||||
if (_reply->error() != QNetworkReply::NoError) {
|
||||
|
||||
if (_account->credentials()->retryIfNeeded(this))
|
||||
if (retryAble() && _account->credentials()->retryIfNeeded(this))
|
||||
return;
|
||||
|
||||
if (!_ignoreCredentialFailure || _reply->error() != QNetworkReply::AuthenticationRequiredError) {
|
||||
|
||||
@ -98,6 +98,10 @@ public:
|
||||
*/
|
||||
static int httpTimeout;
|
||||
|
||||
/** whether or noth this job can be retried */
|
||||
bool retryAble() const;
|
||||
void setRetryAble(bool retryAble);
|
||||
|
||||
public slots:
|
||||
void setTimeout(qint64 msec);
|
||||
void resetTimeout();
|
||||
@ -202,6 +206,8 @@ private:
|
||||
//
|
||||
// Reparented to the currently running QNetworkReply.
|
||||
QPointer<QIODevice> _requestBody;
|
||||
|
||||
bool _retryAble = true;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@ -249,6 +249,7 @@ SimpleNetworkJob *OAuth::postTokenRequest(const QList<QPair<QString, QString>> &
|
||||
|
||||
auto job = _account->sendRequest("POST", requestTokenUrl, req, requestBody);
|
||||
job->setTimeout(qMin(30 * 1000ll, job->timeoutMsec()));
|
||||
job->setRetryAble(false);
|
||||
return job;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user