|
@@ -359,7 +359,6 @@ circuitmux_detach_all_circuits(circuitmux_t *cmux)
|
|
U64_PRINTF_ARG(to_remove->chan_id));
|
|
U64_PRINTF_ARG(to_remove->chan_id));
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
if (to_remove->muxinfo.policy_data) {
|
|
if (to_remove->muxinfo.policy_data) {
|
|
|
|
|
|
@@ -1254,6 +1253,35 @@ circuitmux_set_num_cells(circuitmux_t *cmux, circuit_t *circ,
|
|
* notify that cells have been transmitted.
|
|
* notify that cells have been transmitted.
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
+
|
|
|
|
+ * Pick a circuit to send from, using the active circuits list or a
|
|
|
|
+ * circuitmux policy if one is available. This is called from channel.c.
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+circuit_t *
|
|
|
|
+circuitmux_get_first_active_circuit(circuitmux_t *cmux)
|
|
|
|
+{
|
|
|
|
+ circuit_t *circ = NULL;
|
|
|
|
+
|
|
|
|
+ tor_assert(cmux);
|
|
|
|
+
|
|
|
|
+ if (cmux->n_active_circuits > 0) {
|
|
|
|
+
|
|
|
|
+ tor_assert(cmux->n_cells > 0);
|
|
|
|
+
|
|
|
|
+ if (cmux->policy && cmux->policy->pick_active_circuit) {
|
|
|
|
+ circ = cmux->policy->pick_active_circuit(cmux, cmux->policy_data);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!circ) {
|
|
|
|
+ tor_assert(cmux->active_circuits_head);
|
|
|
|
+ circ = cmux->active_circuits_head;
|
|
|
|
+ }
|
|
|
|
+ } else tor_assert(cmux->n_cells == 0);
|
|
|
|
+
|
|
|
|
+ return circ;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
|
|
* Notify the circuitmux that cells have been sent on a circuit; this
|
|
* Notify the circuitmux that cells have been sent on a circuit; this
|
|
* is called from channel.c.
|
|
* is called from channel.c.
|
|
@@ -1310,7 +1338,7 @@ circuitmux_notify_xmit_cells(circuitmux_t *cmux, circuit_t *circ,
|
|
|
|
|
|
|
|
|
|
* Now make the circuit inactive if needed; this will call the policy's
|
|
* Now make the circuit inactive if needed; this will call the policy's
|
|
- * notify_circ_inactive() if present.
|
|
+ * notify_circ_inactive() if present.
|
|
*/
|
|
*/
|
|
if (becomes_inactive) {
|
|
if (becomes_inactive) {
|
|
--(cmux->n_active_circuits);
|
|
--(cmux->n_active_circuits);
|