tor  0.4.0.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-2018, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
6 
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);
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
36 STATIC int download_status_schedule_get_delay(download_status_t *dls,
37  int min_delay,
38  time_t now);
39 
40 STATIC int find_dl_min_delay(const download_status_t *dls,
41  const or_options_t *options);
42 
43 STATIC int next_random_exponential_delay(int delay,
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
57 
58 #endif /* !defined(TOR_DLSTATUS_H) */
int download_status_get_n_failures(const download_status_t *dls)
Definition: dlstatus.c:397
void download_status_reset(download_status_t *dls)
Definition: dlstatus.c:359
time_t download_status_get_next_attempt_at(const download_status_t *dls)
Definition: dlstatus.c:413
int download_status_is_ready(download_status_t *dls, time_t now)
Definition: dlstatus.c:376
time_t download_status_increment_attempt(download_status_t *dls, const char *item, time_t now)
Definition: dlstatus.c:304
void download_status_mark_impossible(download_status_t *dl)
Definition: dlstatus.c:388
time_t download_status_increment_failure(download_status_t *dls, int status_code, const char *item, int server, time_t now)
Definition: dlstatus.c:245
int download_status_get_n_attempts(const download_status_t *dls)
Definition: dlstatus.c:406