aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-12-07 18:57:29 +0000
committerNick Mathewson <nickm@torproject.org>2006-12-07 18:57:29 +0000
commit63e4cfbeb609f88bdcc622b63cc74558a6e0e235 (patch)
treec10b8419aefbc4a8553448d8167502aff960bde2 /src
parent613af4bc98b860c568dc754cf6e0d7c2fb7c2bfa (diff)
downloadtor-63e4cfbeb609f88bdcc622b63cc74558a6e0e235.tar.gz
tor-63e4cfbeb609f88bdcc622b63cc74558a6e0e235.zip
r11461@Kushana: nickm | 2006-12-07 13:16:45 -0500
Change logging format of state file to only include non-default values. Adjust clients to never store bandwidth history in the state file. (Possible backport candidate.) svn:r9043
Diffstat (limited to 'src')
-rw-r--r--src/or/config.c10
-rw-r--r--src/or/rephist.c12
2 files changed, 15 insertions, 7 deletions
diff --git a/src/or/config.c b/src/or/config.c
index 1db8d65f4f..9beb10a6c2 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -274,11 +274,11 @@ static config_var_t _state_vars[] = {
VAR("EntryGuards", LINELIST_V, EntryGuards, NULL),
VAR("BWHistoryReadEnds", ISOTIME, BWHistoryReadEnds, NULL),
- VAR("BWHistoryReadInterval", UINT, BWHistoryReadInterval, NULL),
- VAR("BWHistoryReadValues", CSV, BWHistoryReadValues, NULL),
+ VAR("BWHistoryReadInterval", UINT, BWHistoryReadInterval, "900"),
+ VAR("BWHistoryReadValues", CSV, BWHistoryReadValues, ""),
VAR("BWHistoryWriteEnds", ISOTIME, BWHistoryWriteEnds, NULL),
- VAR("BWHistoryWriteInterval", UINT, BWHistoryWriteInterval, NULL),
- VAR("BWHistoryWriteValues", CSV, BWHistoryWriteValues, NULL),
+ VAR("BWHistoryWriteInterval", UINT, BWHistoryWriteInterval, "900"),
+ VAR("BWHistoryWriteValues", CSV, BWHistoryWriteValues, ""),
VAR("TorVersion", STRING, TorVersion, NULL),
@@ -3968,7 +3968,7 @@ or_state_save(void)
global_state->LastWritten = time(NULL);
tor_free(global_state->TorVersion);
global_state->TorVersion = tor_strdup("Tor " VERSION);
- state = config_dump(&state_format, global_state, 0);
+ state = config_dump(&state_format, global_state, 1);
len = strlen(state)+128;
contents = tor_malloc(len);
format_local_iso_time(tbuf, time(NULL));
diff --git a/src/or/rephist.c b/src/or/rephist.c
index 0e0530abbc..20b76679bd 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -659,12 +659,20 @@ rep_hist_update_state(or_state_t *state)
s_interval= r?&state->BWHistoryReadInterval:&state->BWHistoryWriteInterval;
s_values = r?&state->BWHistoryReadValues :&state->BWHistoryWriteValues;
- *s_begins = b->next_period;
- *s_interval = NUM_SECS_BW_SUM_INTERVAL;
if (*s_values) {
SMARTLIST_FOREACH(*s_values, char *, cp, tor_free(cp));
smartlist_free(*s_values);
}
+ if (! server_mode(get_options())) {
+ /* Clients don't need to store bandwidth history persistently;
+ * force these values to the defaults. */
+ *s_begins = 0;
+ *s_interval = 900;
+ *s_values = smartlist_create();
+ continue;
+ }
+ *s_begins = b->next_period;
+ *s_interval = NUM_SECS_BW_SUM_INTERVAL;
cp = buf;
cp += rep_hist_fill_bandwidth_history(cp, len, b);
tor_snprintf(cp, len-(cp-buf), cp == buf ? U64_FORMAT : ","U64_FORMAT,