mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
turn MAX_REND_FAILURES into a function
no actual changes in behavior
This commit is contained in:
parent
a15eb9ff43
commit
cc5a9e9667
@ -108,13 +108,18 @@ struct rend_service_port_config_s {
|
|||||||
/** Don't try to build more than this many circuits before giving up
|
/** Don't try to build more than this many circuits before giving up
|
||||||
* for a while.*/
|
* for a while.*/
|
||||||
#define MAX_INTRO_CIRCS_PER_PERIOD 10
|
#define MAX_INTRO_CIRCS_PER_PERIOD 10
|
||||||
/** How many times will a hidden service operator attempt to connect to
|
|
||||||
* a requested rendezvous point before giving up? */
|
|
||||||
#define MAX_REND_FAILURES 1
|
|
||||||
/** How many seconds should we spend trying to connect to a requested
|
/** How many seconds should we spend trying to connect to a requested
|
||||||
* rendezvous point before giving up? */
|
* rendezvous point before giving up? */
|
||||||
#define MAX_REND_TIMEOUT 30
|
#define MAX_REND_TIMEOUT 30
|
||||||
|
|
||||||
|
/** How many times will a hidden service operator attempt to connect to
|
||||||
|
* a requested rendezvous point before giving up? */
|
||||||
|
static int
|
||||||
|
get_max_rend_failures(void)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Hidden service directory file names:
|
/* Hidden service directory file names:
|
||||||
* new file names should be added to rend_service_add_filenames_to_list()
|
* new file names should be added to rend_service_add_filenames_to_list()
|
||||||
* for sandboxing purposes. */
|
* for sandboxing purposes. */
|
||||||
@ -2028,7 +2033,8 @@ rend_service_receive_introduction(origin_circuit_t *circuit,
|
|||||||
|
|
||||||
/* Launch a circuit to the client's chosen rendezvous point.
|
/* Launch a circuit to the client's chosen rendezvous point.
|
||||||
*/
|
*/
|
||||||
for (i=0;i<MAX_REND_FAILURES;i++) {
|
int max_rend_failures=get_max_rend_failures();
|
||||||
|
for (i=0;i<max_rend_failures;i++) {
|
||||||
int flags = CIRCLAUNCH_NEED_CAPACITY | CIRCLAUNCH_IS_INTERNAL;
|
int flags = CIRCLAUNCH_NEED_CAPACITY | CIRCLAUNCH_IS_INTERNAL;
|
||||||
if (circ_needs_uptime) flags |= CIRCLAUNCH_NEED_UPTIME;
|
if (circ_needs_uptime) flags |= CIRCLAUNCH_NEED_UPTIME;
|
||||||
/* A Single Onion Service only uses a direct connection if its
|
/* A Single Onion Service only uses a direct connection if its
|
||||||
@ -2930,11 +2936,13 @@ rend_service_relaunch_rendezvous(origin_circuit_t *oldcirc)
|
|||||||
}
|
}
|
||||||
oldcirc->hs_service_side_rend_circ_has_been_relaunched = 1;
|
oldcirc->hs_service_side_rend_circ_has_been_relaunched = 1;
|
||||||
|
|
||||||
/* We check failure_count >= MAX_REND_FAILURES-1 below rather than
|
/* We check failure_count >= get_max_rend_failures()-1 below, and the -1
|
||||||
* failure_count >= MAX_REND_FAILURES, because we increment the failure
|
* is because we increment the failure count for our current failure
|
||||||
* count for our current failure *after* this clause. */
|
* *after* this clause. */
|
||||||
|
int max_rend_failures = get_max_rend_failures() - 1;
|
||||||
|
|
||||||
if (!oldcirc->build_state ||
|
if (!oldcirc->build_state ||
|
||||||
oldcirc->build_state->failure_count >= MAX_REND_FAILURES-1 ||
|
oldcirc->build_state->failure_count >= max_rend_failures ||
|
||||||
oldcirc->build_state->expiry_time < time(NULL)) {
|
oldcirc->build_state->expiry_time < time(NULL)) {
|
||||||
log_info(LD_REND,
|
log_info(LD_REND,
|
||||||
"Attempt to build circuit to %s for rendezvous has failed "
|
"Attempt to build circuit to %s for rendezvous has failed "
|
||||||
|
Loading…
Reference in New Issue
Block a user