- m_refreshing.erase(aCat);
- if (m_refreshing.empty()) {
- if (m_delegate) {
- m_delegate->refreshComplete();
+ CatalogDict::iterator catIt = d->catalogs.find(aCat->id());
+ if (aReason != Delegate::FAIL_SUCCESS) {
+ if (d->delegate) {
+ d->delegate->failedRefresh(aCat, aReason);
+ }
+
+ // if the failure is permanent, delete the catalog from our
+ // list (don't touch it on disk)
+ bool isPermanentFailure = (aReason == Delegate::FAIL_VERSION);
+ if (isPermanentFailure) {
+ SG_LOG(SG_GENERAL, SG_WARN, "permanent failure for catalog:" << aCat->id());
+ if (catIt != d->catalogs.end()) {
+ d->catalogs.erase(catIt);
+ }
+ }
+ } else if (catIt == d->catalogs.end()) {
+ // first fresh, add to our storage now
+ d->catalogs.insert(catIt, CatalogDict::value_type(aCat->id(), aCat));
+ }
+
+ d->refreshing.erase(aCat);
+ if (d->refreshing.empty()) {
+ if (d->delegate) {
+ d->delegate->refreshComplete();