From 833d027778ba97020fb5ded1d94e4b21fbcab766 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 26 Feb 2014 09:51:30 -0500 Subject: Monotonize the OOM-killer data timers In a couple of places, to implement the OOM-circuit-killer defense against sniper attacks, we have counters to remember the age of cells or data chunks. These timers were based on wall clock time, which can move backwards, thus giving roll-over results for our age calculation. This commit creates a low-budget monotonic time, based on ratcheting gettimeofday(), so that even in the event of a time rollback, we don't do anything _really_ stupid. A future version of Tor should update this function to do something even less stupid here, like employ clock_gettime() or its kin. --- src/common/compat_libevent.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/common/compat_libevent.h') diff --git a/src/common/compat_libevent.h b/src/common/compat_libevent.h index 56285ef80d..3190f13005 100644 --- a/src/common/compat_libevent.h +++ b/src/common/compat_libevent.h @@ -90,6 +90,7 @@ int tor_add_bufferevent_to_rate_limit_group(struct bufferevent *bev, void tor_gettimeofday_cached(struct timeval *tv); void tor_gettimeofday_cache_clear(void); +void tor_gettimeofday_cached_monotonic(struct timeval *tv); #endif -- cgit v1.2.3-54-g00ecf