From e877d02fdde73934e727346a9da11018681a4c14 Mon Sep 17 00:00:00 2001 From: Andrea Shepard Date: Mon, 8 Oct 2012 20:06:40 -0700 Subject: [PATCH] Eliminate unnecessary channel_set_cell_handler(), channel_set_var_cell_handler() in channel.c --- src/or/channel.c | 89 +----------------------------------------------- src/or/channel.h | 5 --- 2 files changed, 1 insertion(+), 93 deletions(-) diff --git a/src/or/channel.c b/src/or/channel.c index b3ab2f0733..f987caed52 100644 --- a/src/or/channel.c +++ b/src/or/channel.c @@ -916,50 +916,7 @@ void } /** - * Set the fixed-length cell handler for a channel - * - * This function sets the fixed-length cell handler for a channel and - * processes any incoming cells that had been blocked in the queue because - * none was available. - * - * @param chan Channel to set the fixed-length cell handler for - * @param cell_handler Function pointer to new fixed-length cell handler - */ - -void -channel_set_cell_handler(channel_t *chan, - void (*cell_handler)(channel_t *, cell_t *)) -{ - int changed = 0; - - tor_assert(chan); - tor_assert(!(chan->is_listener)); - tor_assert(chan->state == CHANNEL_STATE_OPENING || - chan->state == CHANNEL_STATE_OPEN || - chan->state == CHANNEL_STATE_MAINT); - - log_debug(LD_CHANNEL, - "Setting cell_handler callback for channel %p to %p", - chan, cell_handler); - - /* - * Keep track whether we've changed it so we know if there's any point in - * re-running the queue. - */ - if (cell_handler != chan->u.cell_chan.cell_handler) changed = 1; - - /* Change it */ - chan->u.cell_chan.cell_handler = cell_handler; - - /* Re-run the queue if we have one and there's any reason to */ - if (chan->u.cell_chan.cell_queue && - (smartlist_len(chan->u.cell_chan.cell_queue) > 0) && - changed && - chan->u.cell_chan.cell_handler) channel_process_cells(chan); -} - -/** - * Set the both cell handlers for a channel + * Set both cell handlers for a channel * * This function sets both the fixed-length and variable length cell handlers * for a channel and processes any incoming cells that had been blocked in the @@ -1010,50 +967,6 @@ channel_set_cell_handlers(channel_t *chan, chan->u.cell_chan.var_cell_handler)) channel_process_cells(chan); } -/** - * Set the variable-length cell handler for a channel - * - * This function sets the variable-length cell handler for a channel and - * processes any incoming cells that had been blocked in the queue because - * none was available. - * - * @param chan Channel to set the variable-length cell handler for - * @param cell_handler Function pointer to new variable-length cell handler - */ - -void -channel_set_var_cell_handler(channel_t *chan, - void (*var_cell_handler)(channel_t *, - var_cell_t *)) -{ - int changed = 0; - - tor_assert(chan); - tor_assert(!(chan->is_listener)); - tor_assert(chan->state == CHANNEL_STATE_OPENING || - chan->state == CHANNEL_STATE_OPEN || - chan->state == CHANNEL_STATE_MAINT); - - log_debug(LD_CHANNEL, - "Setting var_cell_handler callback for channel %p to %p", - chan, var_cell_handler); - - /* - * Keep track whether we've changed it so we know if there's any point in - * re-running the queue. - */ - if (var_cell_handler != chan->u.cell_chan.var_cell_handler) changed = 1; - - /* Change it */ - chan->u.cell_chan.var_cell_handler = var_cell_handler; - - /* Re-run the queue if we have one and there's any reason to */ - if (chan->u.cell_chan.cell_queue && - (smartlist_len(chan->u.cell_chan.cell_queue) > 0) && - changed && chan->u.cell_chan.var_cell_handler) - channel_process_cells(chan); -} - /** * Request a channel be closed * diff --git a/src/or/channel.h b/src/or/channel.h index 70759818fe..fbcd38d370 100644 --- a/src/or/channel.h +++ b/src/or/channel.h @@ -247,15 +247,10 @@ void (* channel_get_cell_handler(channel_t *chan)) (channel_t *, cell_t *); void (* channel_get_var_cell_handler(channel_t *chan)) (channel_t *, var_cell_t *); -void channel_set_cell_handler(channel_t *chan, - void (*cell_handler)(channel_t *, cell_t *)); void channel_set_cell_handlers(channel_t *chan, void (*cell_handler)(channel_t *, cell_t *), void (*var_cell_handler)(channel_t *, var_cell_t *)); -void channel_set_var_cell_handler(channel_t *chan, - void (*var_cell_handler)(channel_t *, - var_cell_t *)); /* Clean up closed channels periodically; called from run_scheduled_events() * in main.c