]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Read "circwindow=x" from the consensus and use it
authorRoger Dingledine <arma@torproject.org>
Tue, 15 Sep 2009 10:33:33 +0000 (06:33 -0400)
committerRoger Dingledine <arma@torproject.org>
Tue, 15 Sep 2009 10:33:33 +0000 (06:33 -0400)
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.

ChangeLog
src/or/circuitbuild.c
src/or/circuitlist.c
src/or/or.h
src/or/rendclient.c
src/or/rendservice.c

index b1cb770b4ad877811cc4b18ac6d47747f02aedcd..b6863ca6c152006f89a5fab40a22171d21546d42 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index 4432c254935268ad73122c9005061640096ffd90..6f559d98868e82fa8d1b807df076f1ceca515b01 100644 (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;
index 065559620c714d8692d0e5f7990660f399eff203..e1da11716842840082c50eab6f9a528bca9c33c3 100644 (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);
index c93b8ed0fd36ff16731fabb41636e44dbb7b4e21..8587ea61fca2bdd54308cfc7f20d80d902f7263b 100644 (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,
index 141efdc6a31b7dff2a025693fd18c49a4876a36f..fc8d05b6ad94ab8f43a82b51304c573a4c5cd11f 100644 (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);
index 7a970e490d11dddd369fd84123c7ff242c3b6cc2..1beebd2ed60a5e1593623001663c117d4fa8c0c5 100644 (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);