Tor
0.4.7.0-alpha-dev
|
Header file for dlstatus.c. More...
Go to the source code of this file.
Macros | |
#define | download_status_failed(dls, sc) |
Functions | |
time_t | download_status_increment_failure (download_status_t *dls, int status_code, const char *item, int server, time_t now) |
time_t | download_status_increment_attempt (download_status_t *dls, const char *item, time_t now) |
void | download_status_reset (download_status_t *dls) |
int | download_status_is_ready (download_status_t *dls, time_t now) |
time_t | download_status_get_next_attempt_at (const download_status_t *dls) |
void | download_status_mark_impossible (download_status_t *dl) |
int | download_status_get_n_failures (const download_status_t *dls) |
int | download_status_get_n_attempts (const download_status_t *dls) |
Header file for dlstatus.c.
Definition in file dlstatus.h.
#define download_status_failed | ( | dls, | |
sc | |||
) |
Increment the failure count of the download_status_t dls, with the optional status code sc.
Definition at line 22 of file dlstatus.h.
int download_status_get_n_attempts | ( | const download_status_t * | dls | ) |
Return the number of attempts to download dls since the last success (if any). This can differ from download_status_get_n_failures() due to outstanding concurrent attempts.
Definition at line 411 of file dlstatus.c.
int download_status_get_n_failures | ( | const download_status_t * | dls | ) |
Return the number of failures on dls since the last success (if any).
Definition at line 402 of file dlstatus.c.
Referenced by authority_cert_dl_looks_uncertain().
time_t download_status_get_next_attempt_at | ( | const download_status_t * | dls | ) |
Return the next time to attempt to download dls.
Definition at line 418 of file dlstatus.c.
Referenced by download_status_is_ready().
time_t download_status_increment_attempt | ( | download_status_t * | dls, |
const char * | item, | ||
time_t | now | ||
) |
Determine when the next download attempt should be made when using an attempt-based (potentially concurrent) download schedule. Called when an attempt to download dls is being initiated. Increment the attempt count and set dls->next_attempt_at to an appropriate time in the future and return it. If dls->increment_on is DL_SCHED_INCREMENT_FAILURE, don't increment the attempts, and return a time in the far future (to avoid launching a concurrent attempt).
Definition at line 309 of file dlstatus.c.
time_t download_status_increment_failure | ( | download_status_t * | dls, |
int | status_code, | ||
const char * | item, | ||
int | server, | ||
time_t | now | ||
) |
Determine when a failed download attempt should be retried. Called when an attempt to download dls has failed with HTTP status status_code. Increment the failure count (if the code indicates a real failure, or if we're a server) and set dls->next_attempt_at to an appropriate time in the future and return it. If dls->increment_on is DL_SCHED_INCREMENT_ATTEMPT, increment the failure count, and return a time in the far future for the next attempt (to avoid an immediate retry).
Definition at line 250 of file dlstatus.c.
int download_status_is_ready | ( | download_status_t * | dls, |
time_t | now | ||
) |
Return true iff, as of now, the resource tracked by dls is ready to get its download reattempted.
Definition at line 381 of file dlstatus.c.
Referenced by download_status_is_ready_by_sk_in_cl(), and fetch_bridge_descriptors().
void download_status_mark_impossible | ( | download_status_t * | dl | ) |
Mark dl as never downloadable.
Definition at line 393 of file dlstatus.c.
Referenced by fetch_bridge_descriptors(), and launch_direct_bridge_descriptor_fetch().
void download_status_reset | ( | download_status_t * | dls | ) |
Reset dls so that it will be considered downloadable immediately, and/or to show that we don't need it anymore.
Must be called to initialise a download schedule, otherwise the zeroth item in the schedule will never be used.
(We find the zeroth element of the download schedule, and set next_attempt_at to be the appropriate offset from 'now'. In most cases this means setting it to 'now', so the item will be immediately downloadable; when using authorities with fallbacks, there is a few seconds' delay.)
Definition at line 364 of file dlstatus.c.
Referenced by download_status_increment_attempt(), download_status_increment_failure(), download_status_is_ready(), and learned_bridge_descriptor().