diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-08-15 15:42:14 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-08-15 15:58:00 -0400 |
commit | db2af2abb03a82e7c71581efa04a45869feba38a (patch) | |
tree | f5af77ffc83a6ec5a0056e408a0de545f333429d | |
parent | be231b0db196513036ee624dc5b9b87c4f898625 (diff) | |
download | tor-db2af2abb03a82e7c71581efa04a45869feba38a.tar.gz tor-db2af2abb03a82e7c71581efa04a45869feba38a.zip |
Start converting circuitlist to smartlist.
-rw-r--r-- | src/or/circuitlist.c | 9 | ||||
-rw-r--r-- | src/or/circuitlist.h | 4 | ||||
-rw-r--r-- | src/or/or.h | 4 |
3 files changed, 8 insertions, 9 deletions
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c index f3a83503ef..f3518751b1 100644 --- a/src/or/circuitlist.c +++ b/src/or/circuitlist.c @@ -38,8 +38,7 @@ /********* START VARIABLES **********/ /** A global list of all circuits at this hop. */ -struct global_circuitlist_s global_circuitlist = - TOR_LIST_HEAD_INITIALIZER(global_circuitlist); +static smartlist_t *global_circuitlist = NULL; /** A list of all the circuits in CIRCUIT_STATE_CHAN_WAIT. */ static smartlist_t *circuits_pending_chans = NULL; @@ -458,10 +457,12 @@ circuit_close_all_marked(void) } /** Return the head of the global linked list of circuits. */ -MOCK_IMPL(struct global_circuitlist_s *, +MOCK_IMPL(smartlist_t *, circuit_get_global_list,(void)) { - return &global_circuitlist; + if (NULL == global_circuitlist) + global_circuitlist = smartlist_new(); + return global_circuitlist; } /** Function to make circ-\>state human-readable */ diff --git a/src/or/circuitlist.h b/src/or/circuitlist.h index d48d7c3963..03934f971e 100644 --- a/src/or/circuitlist.h +++ b/src/or/circuitlist.h @@ -14,9 +14,7 @@ #include "testsupport.h" -TOR_LIST_HEAD(global_circuitlist_s, circuit_t); - -MOCK_DECL(struct global_circuitlist_s*, circuit_get_global_list, (void)); +MOCK_DECL(smartlist_t *, circuit_get_global_list, (void)); const char *circuit_state_to_string(int state); const char *circuit_purpose_to_controller_string(uint8_t purpose); const char *circuit_purpose_to_controller_hs_state_string(uint8_t purpose); diff --git a/src/or/or.h b/src/or/or.h index 0419111a4e..e106a745b2 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -2864,8 +2864,8 @@ typedef struct circuit_t { /** Unique ID for measuring tunneled network status requests. */ uint64_t dirreq_id; - /** Next circuit in linked list of all circuits (global_circuitlist). */ - TOR_LIST_ENTRY(circuit_t) head; + /** Index in smartlist of all circuits (global_circuitlist). */ + int global_circuitlist_idx; /** Next circuit in the doubly-linked ring of circuits waiting to add * cells to n_conn. NULL if we have no cells pending, or if we're not |