Read "circwindow=x" from the consensus and use it

Tor now reads the "circwindow" parameter out of the consensus,
and uses that value for its circuit package window rather than the
default of 1000 cells. Begins the implementation of proposal 168.
This commit is contained in:
Roger Dingledine 2009-09-15 06:33:33 -04:00
parent 40bcab1faf
commit c43859c5c1
6 changed files with 23 additions and 7 deletions

View File

@ -1,8 +1,11 @@
Changes in version 0.2.2.2-alpha - 2009-09-??
o Major features:
- Authorities can now vote on arbitary integer values as part of the
consensus process. This is designed to help set network parameters.
consensus process. This is designed to help set network parameters.
Implements proposal 167.
- Tor now reads the "circwindow" parameter out of the consensus,
and uses that value for its circuit package window rather than the
default of 1000 cells. Begins the implementation of proposal 168.
o Minor bugfixes:
- Fix an extremely rare infinite recursion bug that could occur if

View File

@ -1833,7 +1833,7 @@ onion_append_hop(crypt_path_t **head_ptr, extend_info_t *choice)
hop->extend_info = extend_info_dup(choice);
hop->package_window = CIRCWINDOW_START;
hop->package_window = circuit_initial_package_window();
hop->deliver_window = CIRCWINDOW_START;
return 0;

View File

@ -361,6 +361,18 @@ circuit_purpose_to_controller_string(uint8_t purpose)
}
}
/** Pick a reasonable package_window to start out for our circuits.
* Originally this was hard-coded at 1000, but now the consensus votes
* on the answer. See proposal 168. */
int32_t
circuit_initial_package_window(void)
{
networkstatus_t *consensus = networkstatus_get_latest_consensus();
if (consensus)
return networkstatus_get_param(consensus, "circwindow", CIRCWINDOW_START);
return CIRCWINDOW_START;
}
/** Initialize the common elements in a circuit_t, and add it to the global
* list. */
static void
@ -368,7 +380,7 @@ init_circuit_base(circuit_t *circ)
{
circ->timestamp_created = time(NULL);
circ->package_window = CIRCWINDOW_START;
circ->package_window = circuit_initial_package_window();
circ->deliver_window = CIRCWINDOW_START;
circuit_add(circ);

View File

@ -1870,9 +1870,9 @@ typedef struct crypt_path_t {
struct crypt_path_t *prev; /**< Link to previous crypt_path_t in the
* circuit. */
int package_window; /**< How many bytes are we allowed to originate ending
int package_window; /**< How many cells are we allowed to originate ending
* at this step? */
int deliver_window; /**< How many bytes are we willing to deliver originating
int deliver_window; /**< How many cells are we willing to deliver originating
* at this step? */
} crypt_path_t;
@ -2864,6 +2864,7 @@ void circuit_set_n_circid_orconn(circuit_t *circ, circid_t id,
or_connection_t *conn);
void circuit_set_state(circuit_t *circ, uint8_t state);
void circuit_close_all_marked(void);
int32_t circuit_initial_package_window(void);
origin_circuit_t *origin_circuit_new(void);
or_circuit_t *or_circuit_new(circid_t p_circ_id, or_connection_t *p_conn);
circuit_t *circuit_get_by_circid_orconn(circid_t circ_id,

View File

@ -644,7 +644,7 @@ rend_client_receive_rendezvous(origin_circuit_t *circ, const char *request,
/* set the windows to default. these are the windows
* that alice thinks bob has.
*/
hop->package_window = CIRCWINDOW_START;
hop->package_window = circuit_initial_package_window();
hop->deliver_window = CIRCWINDOW_START;
onion_append_to_cpath(&circ->cpath, hop);

View File

@ -1477,7 +1477,7 @@ rend_service_rendezvous_has_opened(origin_circuit_t *circuit)
/* set the windows to default. these are the windows
* that bob thinks alice has.
*/
hop->package_window = CIRCWINDOW_START;
hop->package_window = circuit_initial_package_window();;
hop->deliver_window = CIRCWINDOW_START;
onion_append_to_cpath(&circuit->cpath, hop);