Tor  0.4.7.0-alpha-dev
dlstatus.h
Go to the documentation of this file.
1 /* Copyright (c) 2001 Matej Pfajfar.
2  * Copyright (c) 2001-2004, Roger Dingledine.
3  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
4  * Copyright (c) 2007-2021, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
6 
7 /**
8  * \file dlstatus.h
9  * \brief Header file for dlstatus.c.
10  **/
11 
12 #ifndef TOR_DLSTATUS_H
13 #define TOR_DLSTATUS_H
14 
16  int status_code, const char *item,
17  int server, time_t now);
19  const char *item, time_t now);
20 /** Increment the failure count of the download_status_t <b>dls</b>, with
21  * the optional status code <b>sc</b>. */
22 #define download_status_failed(dls, sc) \
23  download_status_increment_failure((dls), (sc), NULL, \
24  dir_server_mode(get_options()), \
25  time(NULL))
26 
28 int download_status_is_ready(download_status_t *dls, time_t now);
31 
34 
35 #ifdef DLSTATUS_PRIVATE
37  int min_delay,
38  time_t now);
39 
41  const or_options_t *options);
42 
44  int base_delay);
45 
46 STATIC void next_random_exponential_delay_range(int *low_bound_out,
47  int *high_bound_out,
48  int delay,
49  int base_delay);
50 
51 /* no more than quadruple the previous delay (multiplier + 1) */
52 #define DIR_DEFAULT_RANDOM_MULTIPLIER (3)
53 /* no more than triple the previous delay */
54 #define DIR_TEST_NET_RANDOM_MULTIPLIER (2)
55 
56 #endif /* defined(DLSTATUS_PRIVATE) */
57 
58 #endif /* !defined(TOR_DLSTATUS_H) */
STATIC void next_random_exponential_delay_range(int *low_bound_out, int *high_bound_out, int delay, int base_delay)
Definition: dlstatus.c:100
STATIC int download_status_schedule_get_delay(download_status_t *dls, int min_delay, time_t now)
Definition: dlstatus.c:154
STATIC int find_dl_min_delay(const download_status_t *dls, const or_options_t *options)
Definition: dlstatus.c:32
STATIC int next_random_exponential_delay(int delay, int base_delay)
Definition: dlstatus.c:130
int download_status_get_n_attempts(const download_status_t *dls)
Definition: dlstatus.c:411
int download_status_is_ready(download_status_t *dls, time_t now)
Definition: dlstatus.c:381
int download_status_get_n_failures(const download_status_t *dls)
Definition: dlstatus.c:402
time_t download_status_increment_attempt(download_status_t *dls, const char *item, time_t now)
Definition: dlstatus.c:309
time_t download_status_get_next_attempt_at(const download_status_t *dls)
Definition: dlstatus.c:418
time_t download_status_increment_failure(download_status_t *dls, int status_code, const char *item, int server, time_t now)
Definition: dlstatus.c:250
void download_status_mark_impossible(download_status_t *dl)
Definition: dlstatus.c:393
void download_status_reset(download_status_t *dls)
Definition: dlstatus.c:364
#define STATIC
Definition: testsupport.h:32