aboutsummaryrefslogtreecommitdiff
path: root/src/or/circuitmux_ewma.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-05-01 18:28:01 -0400
committerNick Mathewson <nickm@torproject.org>2018-05-01 18:28:01 -0400
commit60fad8d41fc7395bd573a2cd9585ae9cb03febc3 (patch)
treed022179b2fd561140018ac0575b02aea767ae406 /src/or/circuitmux_ewma.c
parent5c5392fea75ea4386466a62dc52cfb1a80d9c14a (diff)
downloadtor-60fad8d41fc7395bd573a2cd9585ae9cb03febc3.tar.gz
tor-60fad8d41fc7395bd573a2cd9585ae9cb03febc3.zip
Stop using approx_time() in circuitmux_ewma.
It doesn't match with the tick-count code any longer. Bug not in any released Tor.
Diffstat (limited to 'src/or/circuitmux_ewma.c')
-rw-r--r--src/or/circuitmux_ewma.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/or/circuitmux_ewma.c b/src/or/circuitmux_ewma.c
index a360327f8e..e85301b26d 100644
--- a/src/or/circuitmux_ewma.c
+++ b/src/or/circuitmux_ewma.c
@@ -250,7 +250,11 @@ static unsigned current_tick_num;
static inline unsigned int
cell_ewma_get_tick(void)
{
- return ((unsigned)approx_time() / EWMA_TICK_LEN);
+ monotime_coarse_t now;
+ monotime_coarse_get(&now);
+ int32_t msec_diff = monotime_coarse_diff_msec32(&start_of_current_tick,
+ &now);
+ return current_tick_num + msec_diff / (1000*EWMA_TICK_LEN);
}
/**