* free it
*/
tor_assert(cmux->policy);
- tor_assert(cmux->policy_data);
tor_assert(cmux->policy->free_circ_data);
/* Call free_circ_data() */
cmux->policy->free_circ_data(cmux,
hashent->muxinfo.cell_count = cell_count;
hashent->muxinfo.direction = direction;
/* Allocate policy specific circuit data if we need it */
- if (cmux->policy && cmux->policy_data &&
- cmux->policy->alloc_circ_data) {
+ if (cmux->policy && cmux->policy->alloc_circ_data) {
+ /* Assert that we have the means to free policy-specific data */
+ tor_assert(cmux->policy->free_circ_data);
+ /* Allocate it */
hashent->muxinfo.policy_data =
cmux->policy->alloc_circ_data(cmux,
cmux->policy_data,
if (hashent->muxinfo.policy_data) {
/* If we have policy data, assert that we have the means to free it */
tor_assert(cmux->policy);
- tor_assert(cmux->policy_data);
tor_assert(cmux->policy->free_circ_data);
/* Call free_circ_data() */
cmux->policy->free_circ_data(cmux,
/* Policy-specific notification */
if (cmux->policy &&
- cmux->policy->notify_circ_active &&
- cmux->policy_data) {
+ cmux->policy->notify_circ_active) {
/* Okay, we need to check the circuit for policy data now */
hashent = circuitmux_find_map_entry(cmux, circ);
/* We should have found something */
tor_assert(hashent);
- /* Check for policy data for the circuit and notify */
- if (hashent->muxinfo.policy_data)
- cmux->policy->notify_circ_active(cmux, cmux->policy_data,
- circ, hashent->muxinfo.policy_data);
+ /* Notify */
+ cmux->policy->notify_circ_active(cmux, cmux->policy_data,
+ circ, hashent->muxinfo.policy_data);
}
}
/* Policy-specific notification */
if (cmux->policy &&
- cmux->policy->notify_circ_inactive &&
- cmux->policy_data) {
+ cmux->policy->notify_circ_inactive) {
/* Okay, we need to check the circuit for policy data now */
hashent = circuitmux_find_map_entry(cmux, circ);
/* We should have found something */
tor_assert(hashent);
- /* Check for policy data for the circuit and notify */
- if (hashent->muxinfo.policy_data)
- cmux->policy->notify_circ_inactive(cmux, cmux->policy_data,
- circ, hashent->muxinfo.policy_data);
+ /* Notify */
+ cmux->policy->notify_circ_inactive(cmux, cmux->policy_data,
+ circ, hashent->muxinfo.policy_data);
}
}
cmux->n_cells += n_cells;
/* Do we need to notify a cmux policy? */
- if (cmux->policy && cmux->policy_data &&
- cmux->policy->notify_set_n_cells) {
- /* Yeah; assert that we have circuit policy data */
- tor_assert(hashent->muxinfo.policy_data);
- /* ... and call notify_set_n_cells */
+ if (cmux->policy && cmux->policy->notify_set_n_cells) {
+ /* Call notify_set_n_cells */
cmux->policy->notify_set_n_cells(cmux,
cmux->policy_data,
circ,