aboutsummaryrefslogtreecommitdiff
path: root/src/common/torint.h
diff options
context:
space:
mode:
authorteor (Tim Wilson-Brown) <teor2345@gmail.com>2015-12-07 17:55:38 +1100
committerteor (Tim Wilson-Brown) <teor2345@gmail.com>2015-12-16 04:37:49 +1100
commit35bbf2e4a4e8ccbc4126ebffda67c48989ec2f06 (patch)
treefd5350e11f9c31c0e59b3eb9c0f8189daf1eea94 /src/common/torint.h
parentd3546aa92bf5c7c1435381b33a42f2a4a3d3c2f5 (diff)
downloadtor-35bbf2e4a4e8ccbc4126ebffda67c48989ec2f06.tar.gz
tor-35bbf2e4a4e8ccbc4126ebffda67c48989ec2f06.zip
Prop210: Add schedules for simultaneous client consensus downloads
Prop210: Add attempt-based connection schedules Existing tor schedules increment the schedule position on failure, then retry the connection after the scheduled time. To make multiple simultaneous connections, we need to increment the schedule position when making each attempt, then retry a (potentially simultaneous) connection after the scheduled time. (Also change find_dl_schedule_and_len to find_dl_schedule, as it no longer takes or returns len.) Prop210: Add multiple simultaneous consensus downloads for clients Make connections on TestingClientBootstrapConsensus*DownloadSchedule, incrementing the schedule each time the client attempts to connect. Check if the number of downloads is less than TestingClientBootstrapConsensusMaxInProgressTries before trying any more connections.
Diffstat (limited to 'src/common/torint.h')
-rw-r--r--src/common/torint.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/common/torint.h b/src/common/torint.h
index 6171700898..418fe0fabf 100644
--- a/src/common/torint.h
+++ b/src/common/torint.h
@@ -336,6 +336,32 @@ typedef uint32_t uintptr_t;
#endif /* time_t_is_signed */
#endif /* ifndef(TIME_MAX) */
+#ifndef TIME_MIN
+
+#ifdef TIME_T_IS_SIGNED
+
+#if (SIZEOF_TIME_T == SIZEOF_INT)
+#define TIME_MIN ((time_t)INT_MIN)
+#elif (SIZEOF_TIME_T == SIZEOF_LONG)
+#define TIME_MIN ((time_t)LONG_MIN)
+#elif (SIZEOF_TIME_T == 8)
+#define TIME_MIN ((time_t)INT64_MIN)
+#else
+#error "Can't define (signed) TIME_MIN"
+#endif
+
+#else
+/* Unsigned case */
+#if (SIZEOF_TIME_T == 4)
+#define TIME_MIN ((time_t)UINT32_MIN)
+#elif (SIZEOF_TIME_T == 8)
+#define TIME_MIN ((time_t)UINT64_MIN)
+#else
+#error "Can't define (unsigned) TIME_MIN"
+#endif
+#endif /* time_t_is_signed */
+#endif /* ifndef(TIME_MIN) */
+
#ifndef SIZE_MAX
#if (SIZEOF_SIZE_T == 4)
#define SIZE_MAX UINT32_MAX