From 9eea42f844801f673b90788ff4f5389b300d81fb Mon Sep 17 00:00:00 2001
From: Andrea Shepard <andrea@torproject.org>
Date: Wed, 22 Jan 2014 01:04:39 -0800
Subject: [PATCH] Make channel_flush_from_first_active_circuit() mockable

---
 src/or/relay.c | 4 ++--
 src/or/relay.h | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/or/relay.c b/src/or/relay.c
index b653616c2c..fee2eec39d 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -2592,8 +2592,8 @@ packed_cell_get_circid(const packed_cell_t *cell, int wide_circ_ids)
  * queue of the first active circuit on <b>chan</b>, and write them to
  * <b>chan</b>-&gt;outbuf.  Return the number of cells written.  Advance
  * the active circuit pointer to the next active circuit in the ring. */
-int
-channel_flush_from_first_active_circuit(channel_t *chan, int max)
+MOCK_IMPL(int,
+channel_flush_from_first_active_circuit, (channel_t *chan, int max))
 {
   circuitmux_t *cmux = NULL;
   int n_flushed = 0;
diff --git a/src/or/relay.h b/src/or/relay.h
index 969c6fb61d..68b4fdf197 100644
--- a/src/or/relay.h
+++ b/src/or/relay.h
@@ -64,7 +64,8 @@ void append_cell_to_circuit_queue(circuit_t *circ, channel_t *chan,
                                   cell_t *cell, cell_direction_t direction,
                                   streamid_t fromstream);
 void channel_unlink_all_circuits(channel_t *chan, smartlist_t *detached_out);
-int channel_flush_from_first_active_circuit(channel_t *chan, int max);
+MOCK_DECL(int, channel_flush_from_first_active_circuit,
+          (channel_t *chan, int max));
 void assert_circuit_mux_okay(channel_t *chan);
 void update_circuit_on_cmux_(circuit_t *circ, cell_direction_t direction,
                              const char *file, int lineno);
-- 
GitLab