aboutsummaryrefslogtreecommitdiff
path: root/src/or/relay.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-12-27 16:38:33 -0500
committerNick Mathewson <nickm@torproject.org>2013-02-08 16:32:58 -0500
commit4bfd7806bfa5047ac4653b73291ee07d1e85d3f1 (patch)
tree14d6844eb76cbccf353d26d895a849d7c8c7727a /src/or/relay.c
parent018fe7d11e148538f29418c5e2ff91ff314c3a11 (diff)
downloadtor-4bfd7806bfa5047ac4653b73291ee07d1e85d3f1.tar
tor-4bfd7806bfa5047ac4653b73291ee07d1e85d3f1.tar.gz
Add explicit check for !first_conn in ...resume_edge_reading_helper
This check isn't necessary (see comment on #7801), but it took at least two smart people a little while to see why it wasn't necessary, so let's have it in to make the code more readable.
Diffstat (limited to 'src/or/relay.c')
-rw-r--r--src/or/relay.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/or/relay.c b/src/or/relay.c
index 3da426e6b..12283fcbb 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -1764,11 +1764,18 @@ circuit_resume_edge_reading_helper(edge_connection_t *first_conn,
int cells_on_queue;
int cells_per_conn;
edge_connection_t *chosen_stream = NULL;
+ int max_to_package;
+
+ if (first_conn == NULL) {
+ /* Don't bother to try to do the rest of this if there are no connections
+ * to resume. */
+ return 0;
+ }
/* How many cells do we have space for? It will be the minimum of
* the number needed to exhaust the package window, and the minimum
* needed to fill the cell queue. */
- int max_to_package = circ->package_window;
+ max_to_package = circ->package_window;
if (CIRCUIT_IS_ORIGIN(circ)) {
cells_on_queue = circ->n_chan_cells.n;
} else {