aboutsummaryrefslogtreecommitdiff
path: root/src/or/entrynodes.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-10-21 13:02:25 -0400
committerNick Mathewson <nickm@torproject.org>2013-10-21 13:02:25 -0400
commit71bd10097677cd035bd97a6c36b85d07fdbafb62 (patch)
treec721e0bbe724ae462e46b7c44ab094c7d4fcdccb /src/or/entrynodes.c
parent17d368281ad374908fb019e29f3f012659be010c (diff)
downloadtor-71bd10097677cd035bd97a6c36b85d07fdbafb62.tar
tor-71bd10097677cd035bd97a6c36b85d07fdbafb62.tar.gz
DROPGUARDS controller command
Implements ticket 9934; patch from "ra"
Diffstat (limited to 'src/or/entrynodes.c')
-rw-r--r--src/or/entrynodes.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c
index b97b2ea39..59cc9a3fc 100644
--- a/src/or/entrynodes.c
+++ b/src/or/entrynodes.c
@@ -598,6 +598,25 @@ remove_dead_entry_guards(time_t now)
return changed ? 1 : 0;
}
+/** Remove all currently listed entry guards. So new ones will be chosen. */
+void
+remove_all_entry_guards(void)
+{
+ char dbuf[HEX_DIGEST_LEN+1];
+
+ while (smartlist_len(entry_guards)) {
+ entry_guard_t *entry = smartlist_get(entry_guards, 0);
+ base16_encode(dbuf, sizeof(dbuf), entry->identity, DIGEST_LEN);
+ log_info(LD_CIRC, "Entry guard '%s' (%s) has been dropped.",
+ entry->nickname, dbuf);
+ control_event_guard(entry->nickname, entry->identity, "DROPPED");
+ entry_guard_free(entry);
+ smartlist_del(entry_guards, 0);
+ }
+ log_entry_guards(LOG_INFO);
+ entry_guards_changed();
+}
+
/** A new directory or router-status has arrived; update the down/listed
* status of the entry guards.
*