aboutsummaryrefslogtreecommitdiff
path: root/src/or/config.c
diff options
context:
space:
mode:
authorKarsten Loesing <karsten.loesing@gmx.net>2009-07-15 16:32:40 +0200
committerKarsten Loesing <karsten.loesing@gmx.net>2009-07-15 16:32:40 +0200
commit8c496d1660c326c0bc2bd5c505255d5ec3b653ec (patch)
tree4cab68d08f3ae7f4b9dbc8c12be028b0139791a1 /src/or/config.c
parent416940d93bac49f78b57a2cf561bd324d75b391f (diff)
downloadtor-8c496d1660c326c0bc2bd5c505255d5ec3b653ec.tar
tor-8c496d1660c326c0bc2bd5c505255d5ec3b653ec.tar.gz
Some tweaks to statistics.
Changes to directory request statistics: - Rename GEOIP statistics to DIRREQ statistics, because they now include more than only GeoIP-based statistics, whereas other statistics are GeoIP-dependent, too. - Rename output file from geoip-stats to dirreq-stats. - Add new config option DirReqStatistics that is required to measure directory request statistics. - Clean up ChangeLog. Also ensure that entry guards statistics have access to a local GeoIP database.
Diffstat (limited to 'src/or/config.c')
-rw-r--r--src/or/config.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/src/or/config.c b/src/or/config.c
index 087a907e4..181155155 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -187,12 +187,13 @@ static config_var_t _option_vars[] = {
V(DirPort, UINT, "0"),
V(DirPortFrontPage, FILENAME, NULL),
OBSOLETE("DirPostPeriod"),
-#ifdef ENABLE_GEOIP_STATS
+#ifdef ENABLE_DIRREQ_STATS
OBSOLETE("DirRecordUsageByCountry"),
OBSOLETE("DirRecordUsageGranularity"),
OBSOLETE("DirRecordUsageRetainIPs"),
OBSOLETE("DirRecordUsageSaveInterval"),
#endif
+ V(DirReqStatistics, BOOL, "0"),
VAR("DirServer", LINELIST, DirServers, NULL),
V(DNSPort, UINT, "0"),
V(DNSListenAddress, LINELIST, NULL),
@@ -1376,17 +1377,25 @@ options_act(or_options_t *old_options)
geoip_load_file(actual_fname, options);
tor_free(actual_fname);
}
-#ifdef ENABLE_GEOIP_STATS
- /* Check if GeoIP database could be loaded. */
- if (!geoip_is_loaded()) {
- log_warn(LD_CONFIG, "Configured to measure GeoIP statistics, but no "
- "GeoIP database found!");
- return -1;
+
+#ifdef ENABLE_DIRREQ_STATS
+ if (options->DirReqStatistics) {
+ /* Check if GeoIP database could be loaded. */
+ if (!geoip_is_loaded()) {
+ log_warn(LD_CONFIG, "Configured to measure directory request "
+ "statistics, but no GeoIP database found!");
+ return -1;
+ }
+ log_notice(LD_CONFIG, "Configured to count directory requests by "
+ "country and write aggregate statistics to disk. Check the "
+ "dirreq-stats file in your data directory that will first "
+ "be written in 24 hours from now.");
}
- log_notice(LD_CONFIG, "Configured to measure usage by country and "
- "write aggregate statistics to disk. Check the geoip-stats file "
- "in your data directory once I've been running for 24 hours.");
+#else
+ log_warn(LD_CONFIG, "DirReqStatistics enabled, but Tor was built "
+ "without support for directory request statistics.");
#endif
+
#ifdef ENABLE_EXIT_STATS
if (options->ExitPortStatistics)
log_notice(LD_CONFIG, "Configured to measure exit port statistics. "
@@ -1417,6 +1426,11 @@ options_act(or_options_t *old_options)
log_warn(LD_CONFIG, "Bridges cannot be configured to measure "
"additional GeoIP statistics as entry guards.");
return -1;
+ } else if (!geoip_is_loaded()) {
+ /* Check if GeoIP database could be loaded. */
+ log_warn(LD_CONFIG, "Configured to measure entry node statistics, "
+ "but no GeoIP database found!");
+ return -1;
} else
log_notice(LD_CONFIG, "Configured to measure entry node "
"statistics. Look for the entry-stats file that will "