aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
Diffstat (limited to 'src/or')
-rw-r--r--src/or/relay.c14
-rw-r--r--src/or/test.c4
2 files changed, 11 insertions, 7 deletions
diff --git a/src/or/relay.c b/src/or/relay.c
index 4fd6648116..491b7a9ce4 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -1479,8 +1479,8 @@ circuit_consider_sending_sendme(circuit_t *circ, crypt_path_t *layer_hint)
#endif
#ifdef ENABLE_CELL_POOL
-static mp_pool_t *cell_pool;
-/* DOCDOC */
+static mp_pool_t *cell_pool = NULL;
+/** Allocate structures to hold cells. */
void
init_cell_pool(void)
{
@@ -1488,7 +1488,7 @@ init_cell_pool(void)
cell_pool = mp_pool_new(sizeof(packed_cell_t), 64);
}
-/* DOCDOC */
+/** Free all storage used to hold cells. */
void
free_cell_pool(void)
{
@@ -1497,20 +1497,22 @@ free_cell_pool(void)
cell_pool = NULL;
}
-/** Release storage held by <b>cell</b> */
+/** Release storage held by <b>cell</b>. */
static INLINE void
packed_cell_free(packed_cell_t *cell)
{
mp_pool_release(cell);
}
-/* DOCDOC */
-static INLINE packed_cell_t*
+/** Allocate and return a new packed_cell_t. */
+static INLINE packed_cell_t *
packed_cell_alloc(void)
{
return mp_pool_get(cell_pool);
}
#else
+/* ENABLE_CELL_POOL isn't defined: here are some stubs to use tor_malloc()
+ * and tor_free() instead. */
void
init_cell_pool(void)
{
diff --git a/src/or/test.c b/src/or/test.c
index 7294e413a7..9b427cfa76 100644
--- a/src/or/test.c
+++ b/src/or/test.c
@@ -2142,13 +2142,15 @@ test_mempool(void)
//mp_pool_assert_ok(pool);
}
if (crypto_rand_int(777)==0)
- mp_pool_clean(pool);
+ mp_pool_clean(pool, 2);
if (i % 777)
mp_pool_assert_ok(pool);
}
SMARTLIST_FOREACH(allocated, void *, m, mp_pool_release(m));
mp_pool_assert_ok(pool);
+ mp_pool_clean(pool, 0);
+ mp_pool_assert_ok(pool);
mp_pool_destroy(pool);
smartlist_free(allocated);
}