diff options
author | Nick Mathewson <nickm@torproject.org> | 2007-02-22 06:21:16 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2007-02-22 06:21:16 +0000 |
commit | fe9224dabc242b67d80aa4d830bb4abee1aaf7a8 (patch) | |
tree | e109b0c3ed586b7d3ed59777d1ec1a25de60ab95 /src/or/main.c | |
parent | 0fb179aa2ecbfa2e8c6a2ef287453b123471f8e9 (diff) | |
download | tor-fe9224dabc242b67d80aa4d830bb4abee1aaf7a8.tar.gz tor-fe9224dabc242b67d80aa4d830bb4abee1aaf7a8.zip |
r11872@catbus: nickm | 2007-02-22 01:08:46 -0500
patch from mwenge: rate-limit newnym.
svn:r9614
Diffstat (limited to 'src/or/main.c')
-rw-r--r-- | src/or/main.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/or/main.c b/src/or/main.c index b2d398b0ca..dc70a401bf 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -54,6 +54,8 @@ static time_t time_to_fetch_directory = 0; static time_t time_to_fetch_running_routers = 0; /** When do we next launch DNS wildcarding checks? */ static time_t time_to_check_for_correct_dns = 0; +/** When do we next allow a SIGNEWNYM? */ +static time_t time_to_allow_next_signewnym = 0; /** Array of all open connections. The first n_conns elements are valid. */ static connection_t *connection_array[MAXCONNECTIONS+1] = @@ -1328,6 +1330,7 @@ signal_callback(int fd, short events, void *arg) uintptr_t sig = (uintptr_t)arg; (void)fd; (void)events; + time_t now = time(NULL); switch (sig) { case SIGTERM: @@ -1371,8 +1374,12 @@ signal_callback(int fd, short events, void *arg) break; #endif case SIGNEWNYM: - circuit_expire_all_dirty_circs(); - addressmap_clear_transient(); + if (time_to_allow_next_signewnym < now) { + circuit_expire_all_dirty_circs(); + addressmap_clear_transient(); +#define NEXT_SIGNEWNYM (5) + time_to_allow_next_signewnym = now + NEXT_SIGNEWNYM; + } break; case SIGCLEARDNSCACHE: addressmap_clear_transient(); |