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.
This commit is contained in:
teor (Tim Wilson-Brown)
2015-12-07 17:55:38 +11:00
parent d3546aa92b
commit 35bbf2e4a4
12 changed files with 1255 additions and 99 deletions
+26
View File
@@ -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