aboutsummaryrefslogtreecommitdiff
path: root/src/or/rephist.c
diff options
context:
space:
mode:
authorKarsten Loesing <karsten.loesing@gmx.net>2011-08-04 20:53:53 +0200
committerKarsten Loesing <karsten.loesing@gmx.net>2011-08-04 20:57:29 +0200
commita6a127c833eace1100aca7ab8ad118862bb8a8b9 (patch)
treeff1f65af5ea2c7109a350bea2d373b882c968b50 /src/or/rephist.c
parent6596aa022f03bad34a3ee9cbd627fefe55c01d54 (diff)
downloadtor-a6a127c833eace1100aca7ab8ad118862bb8a8b9.tar
tor-a6a127c833eace1100aca7ab8ad118862bb8a8b9.tar.gz
Replace files in stats/ rather than appending to them.
Right now, we append statistics to files in the stats/ directory for half of the statistics, whereas we overwrite these files for the other half. In particular, we append buffer, dirreq, and entry stats and overwrite exit, connection, and bridge stats. Appending to files was useful when we didn't include stats in extra-info descriptors, because otherwise we'd have to copy them away to prevent Tor from overwriting them. But now that we include statistics in extra-info descriptors, it makes no sense to keep the old statistics forever. We should change the behavior to overwriting instead of appending for all statistics. Implements #2930.
Diffstat (limited to 'src/or/rephist.c')
-rw-r--r--src/or/rephist.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/or/rephist.c b/src/or/rephist.c
index 1ad08fe93..672e3f3da 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -2490,7 +2490,7 @@ rep_hist_buffer_stats_write(time_t now)
if (check_private_dir(statsdir, CPD_CREATE, get_options()->User) < 0)
goto done;
filename = get_datadir_fname2("stats", "buffer-stats");
- out = start_writing_to_stdio_file(filename, OPEN_FLAGS_APPEND | O_TEXT,
+ out = start_writing_to_stdio_file(filename, OPEN_FLAGS_REPLACE | O_TEXT,
0600, &open_file);
if (!out)
goto done;