mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
Don't remove circuitmux hash table entries in circuitmux_detach_circuit() until after circuitmux_make_circuit_inactive()
This commit is contained in:
parent
1bc9a040f7
commit
bec776480d
@ -1019,7 +1019,7 @@ circuitmux_detach_circuit(circuitmux_t *cmux, circuit_t *circ)
|
|||||||
if (circ->n_chan) {
|
if (circ->n_chan) {
|
||||||
search.chan_id = circ->n_chan->global_identifier;
|
search.chan_id = circ->n_chan->global_identifier;
|
||||||
search.circ_id = circ->n_circ_id;
|
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);
|
&search);
|
||||||
last_searched_direction = CELL_DIRECTION_OUT;
|
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;
|
search.circ_id = TO_OR_CIRCUIT(circ)->p_circ_id;
|
||||||
if (TO_OR_CIRCUIT(circ)->p_chan) {
|
if (TO_OR_CIRCUIT(circ)->p_chan) {
|
||||||
search.chan_id = TO_OR_CIRCUIT(circ)->p_chan->global_identifier;
|
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,
|
cmux->chanid_circid_map,
|
||||||
&search);
|
&search);
|
||||||
last_searched_direction = CELL_DIRECTION_IN;
|
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) {
|
if (hashent) {
|
||||||
/* Update counters */
|
/* Update counters */
|
||||||
--(cmux->n_circuits);
|
--(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;
|
if (last_searched_direction == CELL_DIRECTION_OUT) circ->n_mux = NULL;
|
||||||
else TO_OR_CIRCUIT(circ)->p_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 */
|
/* Free the hash entry */
|
||||||
tor_free(hashent);
|
tor_free(hashent);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user