return u;
}
-static inline URL *registry_url_get(const char *url, size_t urllen) {
- debug(D_REGISTRY, "Registry: registry_url_get('%s')", url);
-
- registry_urls_lock();
+static inline URL *registry_url_get_nolock(const char *url, size_t urllen) {
+ debug(D_REGISTRY, "Registry: registry_url_get_nolock('%s')", url);
URL *u = dictionary_get(registry.urls, url);
if(!u) {
registry.urls_count++;
}
+ return u;
+}
+
+static inline URL *registry_url_get(const char *url, size_t urllen) {
+ debug(D_REGISTRY, "Registry: registry_url_get('%s')", url);
+
+ registry_urls_lock();
+
+ URL *u = registry_url_get_nolock(url, urllen);
+
registry_urls_unlock();
return u;
else
registry_request_delete(p->guid, machine_guid, url, name, when);
+ registry.log_count++;
break;
default:
return -2;
}
+ error_log_limit_unlimited();
+
char tmp_filename[FILENAME_MAX + 1];
char old_filename[FILENAME_MAX + 1];
if(!fp) {
error("Registry: Cannot create file: %s", tmp_filename);
registry_log_unlock();
+ error_log_limit_reset();
return -1;
}
error("Registry: Cannot save registry machines - return value %d", bytes1);
fclose(fp);
registry_log_unlock();
+ error_log_limit_reset();
return bytes1;
}
debug(D_REGISTRY, "Registry: saving machines took %d bytes", bytes1);
error("Registry: Cannot save registry persons - return value %d", bytes2);
fclose(fp);
registry_log_unlock();
+ error_log_limit_reset();
return bytes2;
}
debug(D_REGISTRY, "Registry: saving persons took %d bytes", bytes2);
// it has been moved successfully
// discard the current registry log
registry_log_recreate_nolock();
-
registry.log_count = 0;
}
}
// continue operations
registry_log_unlock();
+ error_log_limit_reset();
return -1;
}
}
*url++ = '\0';
- u = registry_url_allocate_nolock(url, strlen(url));
+ // u = registry_url_allocate_nolock(url, strlen(url));
+ u = registry_url_get_nolock(url, strlen(url));
time_t first_t = strtoul(&s[2], NULL, 16);
}
s[1] = s[10] = s[19] = s[28] = s[31] = '\0';
- u = registry_url_allocate_nolock(&s[32], strlen(&s[32]));
+ // u = registry_url_allocate_nolock(&s[32], strlen(&s[32]));
+ u = registry_url_get_nolock(&s[32], strlen(&s[32]));
MACHINE_URL *mu = registry_machine_url_allocate(m, u, strtoul(&s[2], NULL, 16));
mu->last_t = strtoul(&s[11], NULL, 16);
registry_log_open_nolock();
registry_load();
registry_log_load();
+
+ if(unlikely(registry_should_save_db()))
+ registry_save();
}
return 0;