diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-12-19 13:53:52 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-12-21 10:29:01 -0500 |
commit | 520cf21793e9c6b662c76c02235315f898d10fb9 (patch) | |
tree | 821564c2f105daa4d71980d866d825a2b64cd0c3 /src/or/or.h | |
parent | 1deda2106b0af16daaecc2e27982a28054e28345 (diff) | |
download | tor-520cf21793e9c6b662c76c02235315f898d10fb9.tar.gz tor-520cf21793e9c6b662c76c02235315f898d10fb9.zip |
Move destroy cells into a separate queue type of their own, to save RAM
We've been seeing problems with destroy cells queues taking up a
huge amount of RAM. We can mitigate this, since while a full packed
destroy cell takes 514 bytes, we only need 5 bytes to remember a
circuit ID and a reason.
Fixes bug 24666. Bugfix on 0.2.5.1-alpha, when destroy cell queues
were introduced.
Diffstat (limited to 'src/or/or.h')
-rw-r--r-- | src/or/or.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/or/or.h b/src/or/or.h index adf3cfa866..b6a3f62efe 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -1121,6 +1121,21 @@ typedef struct cell_queue_t { int n; /**< The number of cells in the queue. */ } cell_queue_t; +/** A single queued destroy cell. */ +typedef struct destroy_cell_t { + TOR_SIMPLEQ_ENTRY(destroy_cell_t) next; + circid_t circid; + uint32_t inserted_time; /** Timestamp when this was queued. */ + uint8_t reason; +} destroy_cell_t; + +/** A queue of destroy cells on a channel. */ +typedef struct destroy_cell_queue_t { + /** Linked list of packed_cell_t */ + TOR_SIMPLEQ_HEAD(dcell_simpleq, destroy_cell_t) head; + int n; /**< The number of cells in the queue. */ +} destroy_cell_queue_t; + /** Beginning of a RELAY cell payload. */ typedef struct { uint8_t command; /**< The end-to-end relay command. */ |