aboutsummaryrefslogtreecommitdiff
path: root/src/or/main.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-07-06 16:39:54 -0400
committerNick Mathewson <nickm@torproject.org>2011-07-19 01:58:45 -0400
commit1d3c8c1f74e9f80317a70c3b7d9372dee87dd373 (patch)
tree6242d395e4bef2f9e3cba3e5fcb0c7843b91b9fa /src/or/main.c
parent461623e7f980e8d599829865caf3b3985117004a (diff)
downloadtor-1d3c8c1f74e9f80317a70c3b7d9372dee87dd373.tar.gz
tor-1d3c8c1f74e9f80317a70c3b7d9372dee87dd373.zip
Add a new isolation type and field: "nym epoch"
The "nym epoch" of a stream is defined as the number of times that NEWNYM had been called before the stream was opened. All streams are isolated by nym epoch. This feature should be redundant with existing signewnym stuff, but it provides a good belt-and-suspenders way for us to avoid ever letting any circuit type bypass signewnym.
Diffstat (limited to 'src/or/main.c')
-rw-r--r--src/or/main.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/or/main.c b/src/or/main.c
index 16d4f0e7aa..54e6451e6a 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -114,6 +114,8 @@ static time_t time_to_check_for_correct_dns = 0;
static time_t time_of_last_signewnym = 0;
/** Is there a signewnym request we're currently waiting to handle? */
static int signewnym_is_pending = 0;
+/** How many times have we called newnym? */
+static unsigned newnym_epoch = 0;
/** Smartlist of all open connections. */
static smartlist_t *connection_array = NULL;
@@ -1038,9 +1040,18 @@ signewnym_impl(time_t now)
time_of_last_signewnym = now;
signewnym_is_pending = 0;
+ ++newnym_epoch;
+
control_event_signal(SIGNEWNYM);
}
+/** Return the number of times that signewnym has been called. */
+unsigned
+get_signewnym_epoch(void)
+{
+ return newnym_epoch;
+}
+
/** Perform regular maintenance tasks. This function gets run once per
* second by second_elapsed_callback().
*/