aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Shepard <andrea@torproject.org>2012-10-06 05:45:24 -0700
committerAndrea Shepard <andrea@torproject.org>2012-10-10 00:44:47 -0700
commitbec776480d673dc85afd2a3db052f3d8eb81a5c4 (patch)
tree4137325bcf571aade9012808b65439cc8e38ff6b /src
parent1bc9a040f70cd27f06fac3a9e1b07729442c2f7d (diff)
downloadtor-bec776480d673dc85afd2a3db052f3d8eb81a5c4.tar
tor-bec776480d673dc85afd2a3db052f3d8eb81a5c4.tar.gz
Don't remove circuitmux hash table entries in circuitmux_detach_circuit() until after circuitmux_make_circuit_inactive()
Diffstat (limited to 'src')
-rw-r--r--src/or/circuitmux.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/or/circuitmux.c b/src/or/circuitmux.c
index 44d736a7c..6a6fa6d2d 100644
--- a/src/or/circuitmux.c
+++ b/src/or/circuitmux.c
@@ -1019,7 +1019,7 @@ circuitmux_detach_circuit(circuitmux_t *cmux, circuit_t *circ)
if (circ->n_chan) {
search.chan_id = circ->n_chan->global_identifier;
search.circ_id = circ->n_circ_id;
- hashent = HT_REMOVE(chanid_circid_muxinfo_map, cmux->chanid_circid_map,
+ hashent = HT_FIND(chanid_circid_muxinfo_map, cmux->chanid_circid_map,
&search);
last_searched_direction = CELL_DIRECTION_OUT;
}
@@ -1030,7 +1030,7 @@ circuitmux_detach_circuit(circuitmux_t *cmux, circuit_t *circ)
search.circ_id = TO_OR_CIRCUIT(circ)->p_circ_id;
if (TO_OR_CIRCUIT(circ)->p_chan) {
search.chan_id = TO_OR_CIRCUIT(circ)->p_chan->global_identifier;
- hashent = HT_REMOVE(chanid_circid_muxinfo_map,
+ hashent = HT_FIND(chanid_circid_muxinfo_map,
cmux->chanid_circid_map,
&search);
last_searched_direction = CELL_DIRECTION_IN;
@@ -1038,7 +1038,10 @@ circuitmux_detach_circuit(circuitmux_t *cmux, circuit_t *circ)
}
}
- /* If hashent isn't NULL, we just removed it from the map */
+ /*
+ * If hashent isn't NULL, we have a circuit to detach; don't remove it from
+ * the map until later of circuitmux_make_circuit_inactive() breaks.
+ */
if (hashent) {
/* Update counters */
--(cmux->n_circuits);
@@ -1068,6 +1071,9 @@ circuitmux_detach_circuit(circuitmux_t *cmux, circuit_t *circ)
if (last_searched_direction == CELL_DIRECTION_OUT) circ->n_mux = NULL;
else TO_OR_CIRCUIT(circ)->p_mux = NULL;
+ /* Now remove it from the map */
+ HT_REMOVE(chanid_circid_muxinfo_map, cmux->chanid_circid_map, hashent);
+
/* Free the hash entry */
tor_free(hashent);
}