]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Only record bandwidth usage when accounting is enabled
authorNick Mathewson <nickm@torproject.org>
Mon, 15 Nov 2004 04:48:53 +0000 (04:48 +0000)
committerNick Mathewson <nickm@torproject.org>
Mon, 15 Nov 2004 04:48:53 +0000 (04:48 +0000)
svn:r2886

src/or/main.c

index 81e32fe7001b7c1646acdc6568a6dafb4d39c716..ab3849c735b56cab7141d8416c842ff6e1df24f8 100644 (file)
@@ -737,7 +737,8 @@ static int do_hup(void) {
 
   log_fn(LOG_NOTICE,"Received sighup. Reloading config.");
   has_completed_circuit=0;
-  accounting_record_bandwidth_usage(time(NULL));
+  if (accounting_is_enabled(options))
+    accounting_record_bandwidth_usage(time(NULL));
 
   /* first, reload config variables, in case they've changed */
   /* no need to provide argc/v, they've been cached inside init_from_config */
@@ -1079,7 +1080,8 @@ void tor_cleanup(void) {
   if(options->PidFile && options->command == CMD_RUN_TOR)
     unlink(options->PidFile);
   crypto_global_cleanup();
-  accounting_record_bandwidth_usage(time(NULL));
+  if (accounting_is_enabled(options))
+    accounting_record_bandwidth_usage(time(NULL));
 }
 
 /** Read/create keys as needed, and echo our fingerprint to stdout. */