summaryrefslogtreecommitdiff
path: root/src/or/relay.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-04-11 00:30:34 +0000
committerNick Mathewson <nickm@torproject.org>2007-04-11 00:30:34 +0000
commit51e4b8d7068a3489fb5cb45a8ebcc20036fd0d35 (patch)
treecad4e30bb647186680938182bcd0592917acf4ea /src/or/relay.c
parent28de06b8e654800bb1221467d6c8cbbf8d19987d (diff)
downloadtor-51e4b8d7068a3489fb5cb45a8ebcc20036fd0d35.tar.gz
tor-51e4b8d7068a3489fb5cb45a8ebcc20036fd0d35.zip
r12338@catbus: nickm | 2007-04-10 20:29:05 -0400
Document memory pool implementation, and tweak it even mor. See? Programming is fun. svn:r9940
Diffstat (limited to 'src/or/relay.c')
-rw-r--r--src/or/relay.c14
1 files changed, 8 insertions, 6 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)
{