From df6357907106d24997f416e2d8f8d006d563bf44 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Wed, 25 Nov 2015 10:39:43 +0100 Subject: [PATCH] Blacklist: Firewall errors are silenced for up to 1h only #4071 --- src/libsync/syncjournalfilerecord.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/libsync/syncjournalfilerecord.cpp b/src/libsync/syncjournalfilerecord.cpp index c0bbd6335bf..04664efbf28 100644 --- a/src/libsync/syncjournalfilerecord.cpp +++ b/src/libsync/syncjournalfilerecord.cpp @@ -149,13 +149,18 @@ SyncJournalErrorBlacklistRecord SyncJournalErrorBlacklistRecord::update( entry._lastTryEtag = item._etag; entry._lastTryTime = Utility::qDateTimeToTime_t(QDateTime::currentDateTime()); // The factor of 5 feels natural: 25s, 2 min, 10 min, ~1h, ~5h, ~24h - entry._ignoreDuration = qBound(minBlacklistTime, old._ignoreDuration * 5, maxBlacklistTime); + entry._ignoreDuration = old._ignoreDuration * 5; entry._file = item._file; - if( item._httpErrorCode == 403 || item._httpErrorCode == 413 || item._httpErrorCode == 415 ) { + if (item._httpErrorCode == 403 && item._errorString.contains("firewall", Qt::CaseInsensitive)) { + qDebug() << "Firewall error: " << item._httpErrorCode << ", blacklisting up to 1h only"; + entry._ignoreDuration = qMin(entry._ignoreDuration, time_t(60*60)); + + } else if( item._httpErrorCode == 403 || item._httpErrorCode == 413 || item._httpErrorCode == 415 ) { qDebug() << "Fatal Error condition" << item._httpErrorCode << ", maximum blacklist ignore time!"; entry._ignoreDuration = maxBlacklistTime; } + entry._ignoreDuration = qBound(minBlacklistTime, entry._ignoreDuration, maxBlacklistTime); qDebug() << "blacklisting " << item._file << " for " << entry._ignoreDuration