[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] [tor/master] Warn and exit when we are configured to measure GeoIP statistics, but have no GeoIP database.



Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date: Sat, 30 May 2009 23:35:21 +0200
Subject: Warn and exit when we are configured to measure GeoIP statistics, but have no GeoIP database.
Commit: dfebc88d56e2c5b470fce20cd7b25914cf2507d4

---
 src/or/config.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/or/config.c b/src/or/config.c
index 0cf0db7..c0f473b 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -1378,6 +1378,14 @@ 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;
+  }
+#endif
   /* Check if we need to parse and add the EntryNodes config option. */
   if (options->EntryNodes &&
       (!old_options ||
-- 
1.5.6.5