Add a compile option to not blacklist error code 5xx

This commit is contained in:
Olivier Goffart 2014-04-29 11:39:46 +02:00
parent 7e702778a1
commit f159b028b4
2 changed files with 13 additions and 0 deletions

View file

@ -85,6 +85,14 @@ endif()
# this option creates only libocsync and libowncloudsync
option(BUILD_LIBRARIES_ONLY "BUILD_LIBRARIES_ONLY" OFF)
# When this option is enabled, 5xx errors are not added to the clacklist
# Normaly you don't want to enable this option because if a particular file
# trigger a bug on the server, you want the file to be blacklisted.
option(OWNCLOUD_5XX_NO_BLACKLIST "OWNCLOUD_5XX_NO_BLACKLIST" OFF)
if(OWNCLOUD_5XX_NO_BLACKLIST)
add_definitions(-DOWNCLOUD_5XX_NO_BLACKLIST=1)
endif()
#### find libs
#find_package(Qt4 4.7.0 COMPONENTS QtCore QtGui QtXml QtNetwork QtTest QtWebkit REQUIRED )
#if( UNIX AND NOT APPLE ) # Fdo notifications

View file

@ -45,6 +45,11 @@ void PropagateItemJob::done(SyncFileItem::Status status, const QString &errorStr
if( _item._httpErrorCode == 403 ||_item._httpErrorCode == 413 || _item._httpErrorCode == 415 ) {
qDebug() << "Fatal Error condition" << _item._httpErrorCode << ", forbid retry!";
retries = -1;
#ifdef OWNCLOUD_5XX_NO_BLACKLIST
} else if (_item._httpErrorCode / 100 == 5) {
// In this configuration, never blacklist error 5xx
qDebug() << "Do not blacklist error " << _item._httpErrorCode;
#endif
} else {
static QAtomicInt defaultRetriesCount(qgetenv("OWNCLOUD_BLACKLIST_COUNT").toInt());
if (defaultRetriesCount.fetchAndAddAcquire(0) <= 0) {