diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-05-12 11:10:35 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-05-12 11:10:35 -0400 |
commit | 4ba9f3e31702020eaa336ccb33294568cda256eb (patch) | |
tree | 4bb95303e56a37dc624ef6834886929dfce0ecfe /src/or/or.h | |
parent | 3968e8d14b7f6282963223b0fd4f4ca3afb60c61 (diff) | |
download | tor-4ba9f3e31702020eaa336ccb33294568cda256eb.tar.gz tor-4ba9f3e31702020eaa336ccb33294568cda256eb.zip |
Track where microdescs are referenced to prevent free errs
On IRC, wanoskarnet notes that if we ever do microdesc_free() on a
microdesc that's in the nodelist, we're in trouble. Also, we're in
trouble if we free one that's still in the microdesc_cache map.
This code adds a flag to microdesc_t to note where the microdesc is
referenced from, and checks those flags from microdesc_free(). I
don't believe we have any errors here now, but if we introduce some
later, let's log and recover from them rather than introducing
heisenbugs later on.
Addresses bug 3153.
Diffstat (limited to 'src/or/or.h')
-rw-r--r-- | src/or/or.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/or/or.h b/src/or/or.h index f58876e496..ddc03be87c 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -1709,6 +1709,11 @@ typedef struct microdesc_t { saved_location_t saved_location : 3; /** If true, do not attempt to cache this microdescriptor on disk. */ unsigned int no_save : 1; + /** If true, this microdesc is attached to a node_t. */ + unsigned int held_by_node : 1; + /** If true, this microdesc has an entry in the microdesc_map */ + unsigned int held_in_map : 1; + /** If saved_location == SAVED_IN_CACHE, this field holds the offset of the * microdescriptor in the cache. */ off_t off; |