diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-06-14 11:01:04 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-06-14 11:01:04 -0400 |
commit | a58d94fb7c6c304ecba930eaa7ebbade1d0686ab (patch) | |
tree | 7c36b6a4f13246cec4644ebebba223f774c7dcbf /src/or/circuitlist.c | |
parent | cfca2a6037c139a82677a0ba2776d4ddf6ca6d04 (diff) | |
parent | 8f3e3279c198dd13c11ffd739ddf08dbe8b07762 (diff) | |
download | tor-a58d94fb7c6c304ecba930eaa7ebbade1d0686ab.tar.gz tor-a58d94fb7c6c304ecba930eaa7ebbade1d0686ab.zip |
Merge branch 'bug12184_diagnostic_squashed'
Diffstat (limited to 'src/or/circuitlist.c')
-rw-r--r-- | src/or/circuitlist.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c index 0140afcd77..a2dd07fbe4 100644 --- a/src/or/circuitlist.c +++ b/src/or/circuitlist.c @@ -59,6 +59,8 @@ typedef struct chan_circid_circuit_map_t { channel_t *chan; circid_t circ_id; circuit_t *circuit; + /* For debugging 12184: when was this placeholder item added? */ + time_t made_placeholder_at; } chan_circid_circuit_map_t; /** Helper for hash tables: compare the channel and circuit ID for a and @@ -184,6 +186,7 @@ circuit_set_circid_chan_helper(circuit_t *circ, int direction, found = HT_FIND(chan_circid_map, &chan_circid_map, &search); if (found) { found->circuit = circ; + found->made_placeholder_at = 0; } else { found = tor_malloc_zero(sizeof(chan_circid_circuit_map_t)); found->circ_id = id; @@ -241,11 +244,14 @@ channel_mark_circid_unusable(channel_t *chan, circid_t id) "a circuit there.", (unsigned)id, chan); } else if (ent) { /* It's already marked. */ + if (!ent->made_placeholder_at) + ent->made_placeholder_at = approx_time(); } else { ent = tor_malloc_zero(sizeof(chan_circid_circuit_map_t)); ent->chan = chan; ent->circ_id = id; - /* leave circuit at NULL */ + /* leave circuit at NULL. */ + ent->made_placeholder_at = approx_time(); HT_INSERT(chan_circid_map, &chan_circid_map, ent); } } @@ -1096,6 +1102,27 @@ circuit_id_in_use_on_channel(circid_t circ_id, channel_t *chan) return 0; } +/** Helper for debugging 12184. Returns the time since which 'circ_id' has + * been marked unusable on 'chan'. */ +time_t +circuit_id_when_marked_unusable_on_channel(circid_t circ_id, channel_t *chan) +{ + chan_circid_circuit_map_t search; + chan_circid_circuit_map_t *found; + + memset(&search, 0, sizeof(search)); + search.circ_id = circ_id; + search.chan = chan; + + found = HT_FIND(chan_circid_map, &chan_circid_map, &search); + + if (! found || found->circuit) + return 0; + + return found->made_placeholder_at; +} + + /** Return the circuit that a given edge connection is using. */ circuit_t * circuit_get_by_edge_conn(edge_connection_t *conn) |