]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Stop using approx_time() in circuitmux_ewma.
authorNick Mathewson <nickm@torproject.org>
Tue, 1 May 2018 22:28:01 +0000 (18:28 -0400)
committerNick Mathewson <nickm@torproject.org>
Tue, 1 May 2018 22:28:01 +0000 (18:28 -0400)
It doesn't match with the tick-count code any longer.

Bug not in any released Tor.

src/or/circuitmux_ewma.c

index a360327f8e44bf8a985345f8397593e089285fb4..e85301b26d97500e4a672d4c4ebc9d584c52c1c3 100644 (file)
@@ -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);
 }
 
 /**