|
Tor 0.4.9.3-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 410 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 401 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 417 of file dlstatus.c.
Referenced by download_status_increment_attempt(), download_status_increment_failure(), download_status_is_ready(), and download_status_to_string().
| 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 308 of file dlstatus.c.
Referenced by fetch_bridge_descriptors(), and update_consensus_bootstrap_attempt_downloads().
| 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 249 of file dlstatus.c.
Referenced by dir_microdesc_download_failed(), and dir_routerdesc_download_failed().
| 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 380 of file dlstatus.c.
Referenced by authority_certs_fetch_missing(), download_status_is_ready_by_sk_in_cl(), fetch_bridge_descriptors(), microdesc_list_missing_digest256(), update_consensus_bootstrap_attempt_downloads(), update_consensus_networkstatus_downloads(), update_consensus_router_descriptor_downloads(), and update_extrainfo_downloads().
| void download_status_mark_impossible | ( | download_status_t * | dl | ) |
Mark dl as never downloadable.
Definition at line 392 of file dlstatus.c.
Referenced by dirserv_add_descriptor(), dirserv_add_extrainfo(), fetch_bridge_descriptors(), launch_direct_bridge_descriptor_fetch(), microdescs_add_to_cache(), router_load_extrainfo_from_string(), and router_load_routers_from_string().
| 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 363 of file dlstatus.c.
Referenced by authority_certs_fetch_missing(), download_status_cert_init(), download_status_increment_attempt(), download_status_increment_failure(), download_status_is_ready(), download_status_reset_by_sk_in_cl(), learned_bridge_descriptor(), networkstatus_reset_download_failures(), networkstatus_set_current_consensus(), and routers_update_status_from_consensus_networkstatus().