aboutsummaryrefslogtreecommitdiff
path: root/src/or/rephist.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/rephist.c')
-rw-r--r--src/or/rephist.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/or/rephist.c b/src/or/rephist.c
index 1bb8775d8f..3228d24a3f 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -993,7 +993,8 @@ rep_hist_load_state(or_state_t *state, char **err)
s_values = r?state->BWHistoryReadValues:state->BWHistoryWriteValues;
if (s_values && s_begins >= now - NUM_SECS_BW_SUM_INTERVAL*NUM_TOTALS) {
start = s_begins - s_interval*(smartlist_len(s_values));
-
+ if (start > now)
+ continue;
b->cur_obs_time = start;
b->next_period = start + NUM_SECS_BW_SUM_INTERVAL;
SMARTLIST_FOREACH(s_values, char *, cp, {
@@ -1002,8 +1003,10 @@ rep_hist_load_state(or_state_t *state, char **err)
all_ok=0;
log_notice(LD_GENERAL, "Could not parse '%s' into a number.'", cp);
}
- add_obs(b, start, v);
- start += NUM_SECS_BW_SUM_INTERVAL;
+ if (start < now) {
+ add_obs(b, start, v);
+ start += NUM_SECS_BW_SUM_INTERVAL;
+ }
});
}