summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2006-09-14 05:07:34 +0000
committerPeter Palfrader <peter@palfrader.org>2006-09-14 05:07:34 +0000
commit7fcec095607ea9453f224f6caa0e280f526b0ac8 (patch)
treebc55e8952142bdcd2d0d4938ffb5dd5f8bcdf46f
parent9d9e31dcf4a664d9a8fa2cc8ebe7af93fb9c649b (diff)
downloadtor-7fcec095607ea9453f224f6caa0e280f526b0ac8.tar.gz
tor-7fcec095607ea9453f224f6caa0e280f526b0ac8.zip
r9753@danube: weasel | 2006-09-14 07:07:02 +0200
Remove duplicates from MyFamily svn:r8390
-rw-r--r--src/or/router.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/or/router.c b/src/or/router.c
index 7c42ff77a0..5b7b01c130 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -804,6 +804,7 @@ router_rebuild_descriptor(int force)
if (authdir_mode(options))
ri->is_valid = ri->is_named = 1; /* believe in yourself */
if (options->MyFamily) {
+ int i;
smartlist_t *family;
if (!warned_nonexistent_family)
warned_nonexistent_family = smartlist_create();
@@ -840,6 +841,18 @@ router_rebuild_descriptor(int force)
}
tor_free(name);
});
+
+ smartlist_sort_strings(ri->declared_family);
+ for (i = 1; i < smartlist_len(ri->declared_family); ++i) {
+ const char *a, *b;
+ a = smartlist_get(ri->declared_family, i-1);
+ b = smartlist_get(ri->declared_family, i);
+ if (!strcmp(a,b)) {
+ tor_free(smartlist_get(ri->declared_family, i));
+ smartlist_del_keeporder(ri->declared_family, i--);
+ }
+ }
+
smartlist_free(family);
}
ri->cache_info.signed_descriptor_body = tor_malloc(8192);