summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorKarsten Loesing <karsten.loesing@gmx.net>2013-05-16 12:08:48 +0200
committerKarsten Loesing <karsten.loesing@gmx.net>2013-05-16 12:08:48 +0200
commit1293835440dd4debf6fbfc66e755d9b9384aa362 (patch)
tree11891e6aaee7dafd69fb0077c33b148a8df73f04 /src/common
parent95c34399cfb66a46371562f1532e8aa396243876 (diff)
downloadtor-1293835440dd4debf6fbfc66e755d9b9384aa362.tar.gz
tor-1293835440dd4debf6fbfc66e755d9b9384aa362.zip
Lower dir fetch retry schedules in testing networks.
Also lower maximum interval without directory requests, and raise maximum download tries. Implements #6752.
Diffstat (limited to 'src/common')
-rw-r--r--src/common/container.c19
-rw-r--r--src/common/container.h1
2 files changed, 20 insertions, 0 deletions
diff --git a/src/common/container.c b/src/common/container.c
index eec497a3e6..03c65b7c1e 100644
--- a/src/common/container.c
+++ b/src/common/container.c
@@ -243,6 +243,25 @@ smartlist_strings_eq(const smartlist_t *sl1, const smartlist_t *sl2)
return 1;
}
+/** Return true iff the two lists contain the same ints in the same order,
+ * or if they are both NULL. */
+int
+smartlist_ints_eq(const smartlist_t *sl1, const smartlist_t *sl2)
+{
+ if (sl1 == NULL)
+ return sl2 == NULL;
+ if (sl2 == NULL)
+ return 0;
+ if (smartlist_len(sl1) != smartlist_len(sl2))
+ return 0;
+ SMARTLIST_FOREACH(sl1, int *, cp1, {
+ int *cp2 = smartlist_get(sl2, cp1_sl_idx);
+ if (*cp1 != *cp2)
+ return 0;
+ });
+ return 1;
+}
+
/** Return true iff <b>sl</b> has some element E such that
* tor_memeq(E,<b>element</b>,DIGEST_LEN)
*/
diff --git a/src/common/container.h b/src/common/container.h
index 1a68b8f67b..1bcc540665 100644
--- a/src/common/container.h
+++ b/src/common/container.h
@@ -42,6 +42,7 @@ int smartlist_contains_string_case(const smartlist_t *sl, const char *element);
int smartlist_contains_int_as_string(const smartlist_t *sl, int num);
int smartlist_strings_eq(const smartlist_t *sl1, const smartlist_t *sl2);
int smartlist_contains_digest(const smartlist_t *sl, const char *element);
+int smartlist_ints_eq(const smartlist_t *sl1, const smartlist_t *sl2);
int smartlist_overlap(const smartlist_t *sl1, const smartlist_t *sl2);
void smartlist_intersect(smartlist_t *sl1, const smartlist_t *sl2);
void smartlist_subtract(smartlist_t *sl1, const smartlist_t *sl2);