summaryrefslogtreecommitdiff
path: root/src/or/geoip.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2008-06-04 09:02:25 +0000
committerRoger Dingledine <arma@torproject.org>2008-06-04 09:02:25 +0000
commitb8bde32c3a906ec58a3b37f6e49275a1a8a2d40a (patch)
treebf5e406434cfb84c734b3b6b022304fd5783f809 /src/or/geoip.c
parentc6b3cf4b968f65312a1e52aed53b7256a097ca2b (diff)
downloadtor-b8bde32c3a906ec58a3b37f6e49275a1a8a2d40a.tar.gz
tor-b8bde32c3a906ec58a3b37f6e49275a1a8a2d40a.zip
forward-port r14934
svn:r14936
Diffstat (limited to 'src/or/geoip.c')
-rw-r--r--src/or/geoip.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/or/geoip.c b/src/or/geoip.c
index 3f2076c292..241281317a 100644
--- a/src/or/geoip.c
+++ b/src/or/geoip.c
@@ -122,6 +122,14 @@ _geoip_compare_key_to_entry(const void *_key, const void **_member)
return 0;
}
+/** Return 1 if we should collect geoip stats on bridge users, and
+ * include them in our extrainfo descriptor. Else return 0. */
+int
+should_record_bridge_info(or_options_t *options)
+{
+ return options->BridgeRelay && options->BridgeRecordUsageByCountry;
+}
+
/** Clear the GeoIP database and reload it from the file
* <b>filename</b>. Return 0 on success, -1 on failure.
*
@@ -136,12 +144,13 @@ _geoip_compare_key_to_entry(const void *_key, const void **_member)
* with '#' (comments).
*/
int
-geoip_load_file(const char *filename)
+geoip_load_file(const char *filename, or_options_t *options)
{
FILE *f;
+ int severity = should_record_bridge_info(options) ? LOG_WARN : LOG_INFO;
clear_geoip_db();
if (!(f = fopen(filename, "r"))) {
- log_warn(LD_GENERAL, "Failed to open GEOIP file %s.", filename);
+ log_fn(severity, LD_GENERAL, "Failed to open GEOIP file %s.", filename);
return -1;
}
geoip_countries = smartlist_create();