Well, this is simple, the function got in in 2014, was never used until now and
it was entirely wrong from the start.
This commit fixes it plain and simply.
Signed-off-by: David Goulet <dgoulet@torproject.org>
/** Return true if we've been under memory pressure in the last
* MEMORY_PRESSURE_INTERVAL seconds. */
-int
+bool
have_been_under_memory_pressure(void)
{
- if (last_time_under_memory_pressure == 0) {
- return false;
- }
- return last_time_under_memory_pressure + MEMORY_PRESSURE_INTERVAL
- < approx_time();
+ return approx_time() <
+ last_time_under_memory_pressure + MEMORY_PRESSURE_INTERVAL;
}
/**
void dump_cell_pool_usage(int severity);
size_t packed_cell_mem_cost(void);
-int have_been_under_memory_pressure(void);
+bool have_been_under_memory_pressure(void);
/* For channeltls.c */
void packed_cell_free_(packed_cell_t *cell);