Переглянути джерело

r11726@catbus: nickm | 2007-02-08 16:04:53 -0500
Resolve some XXXX012 items:
- Remove PathlenCoinWeight: if we want it again, we can add it
back in.
- Ditto with RelayBandwidth*.
- Decide to leave in the "hey, you didn't set end_reason!" BUG log message,
but stop telling people to bug me personally.
- Postpone strengthening assert_connection_ok(): it's important, but
it's also a good way to introduce weird bugs.
- Move some expensive consistency checking from dns_free_all() into
assert_cache_ok().


svn:r9533

Nick Mathewson 17 роки тому
батько
коміт
e00a1cbf16
6 змінених файлів з 23 додано та 30 видалено
  1. 2 0
      ChangeLog
  2. 2 5
      src/or/circuitbuild.c
  3. 3 5
      src/or/config.c
  4. 3 4
      src/or/connection.c
  5. 13 10
      src/or/dns.c
  6. 0 6
      src/or/or.h

+ 2 - 0
ChangeLog

@@ -23,6 +23,8 @@ Changes in version 0.1.2.8-alpha - 2007-??-??
     - Warn the user when an application uses the obsolete binary v0 control
       protocol.  We're planning to remove support for it during the next
       development series, so it's good to give people some advance warning.
+    - Remove some never-implemented options.  Mark PathlenCoinWeight as
+      obsolete.
 
 
 Changes in version 0.1.2.7-alpha - 2007-02-06

+ 2 - 5
src/or/circuitbuild.c

@@ -998,14 +998,12 @@ onionskin_answer(or_circuit_t *circ, uint8_t cell_type, const char *payload,
  * is feasible, except if it's less than 2, in which case return -1.
  */
 static int
-new_route_len(double cw, uint8_t purpose, extend_info_t *exit,
+new_route_len(uint8_t purpose, extend_info_t *exit,
               smartlist_t *routers)
 {
   int num_acceptable_routers;
   int routelen;
 
-  tor_assert(cw >= 0.);
-  tor_assert(cw < 1.);
   tor_assert(routers);
 
 #ifdef TOR_PERF
@@ -1354,8 +1352,7 @@ onion_pick_cpath_exit(origin_circuit_t *circ, extend_info_t *exit)
     log_debug(LD_CIRC, "Launching a one-hop circuit for dir tunnel.");
     state->desired_path_len = 1;
   } else {
-    int r = new_route_len(get_options()->PathlenCoinWeight,
-                          circ->_base.purpose, exit, rl->routers);
+    int r = new_route_len(circ->_base.purpose, exit, rl->routers);
     if (r < 1) /* must be at least 1 */
       return -1;
     state->desired_path_len = r;

+ 3 - 5
src/or/config.c

@@ -207,8 +207,7 @@ static config_var_t _option_vars[] = {
   VAR("ORListenAddress",     LINELIST, ORListenAddress,      NULL),
   VAR("ORPort",              UINT,     ORPort,               "0"),
   VAR("OutboundBindAddress", STRING,   OutboundBindAddress,  NULL),
-  /* XXXX012 mark this obsolete?  Warn if it's set? */
-  VAR("PathlenCoinWeight",   DOUBLE,   PathlenCoinWeight,    "0.3"),
+  OBSOLETE("PathlenCoinWeight"),
   VAR("PidFile",             STRING,   PidFile,              NULL),
   VAR("PreferTunneledDirConns", BOOL,  PreferTunneledDirConns, "0"),
   VAR("ProtocolWarnings",    BOOL,     ProtocolWarnings,     "0"),
@@ -221,9 +220,6 @@ static config_var_t _option_vars[] = {
   VAR("RecommendedClientVersions", LINELIST, RecommendedClientVersions,  NULL),
   VAR("RecommendedServerVersions", LINELIST, RecommendedServerVersions,  NULL),
   VAR("RedirectExit",        LINELIST, RedirectExit,         NULL),
-  /* XXXX012 These aren't implemented. Take them out for now? */
-  VAR("RelayBandwidthBurst", MEMUNIT,  RelayBandwidthBurst,  "0"),
-  VAR("RelayBandwidthRate",  MEMUNIT,  RelayBandwidthRate,   "0"),
   VAR("RendExcludeNodes",    STRING,   RendExcludeNodes,     NULL),
   VAR("RendNodes",           STRING,   RendNodes,            NULL),
   VAR("RendPostPeriod",      INTERVAL, RendPostPeriod,       "1 hour"),
@@ -2611,9 +2607,11 @@ options_validate(or_options_t *old_options, or_options_t *options,
       });
   }
 
+#if 0
   if (options->SocksPort >= 1 &&
       (options->PathlenCoinWeight < 0.0 || options->PathlenCoinWeight >= 1.0))
     REJECT("PathlenCoinWeight option must be >=0.0 and <1.0.");
+#endif
 
   if (options->RendPostPeriod < MIN_REND_POST_PERIOD) {
     log(LOG_WARN,LD_CONFIG,"RendPostPeriod option must be at least %d seconds."

+ 3 - 4
src/or/connection.c

@@ -477,9 +477,8 @@ connection_about_to_close_connection(connection_t *conn)
                  conn->marked_for_close_file, conn->marked_for_close);
       }
       if (!edge_conn->end_reason) {
-        // XXXX012 Disable this before 0.1.2.x-final ships.
         log_warn(LD_BUG,"Bug: Closing stream (marked at %s:%d) without having"
-                 " set end_reason. Please tell Nick.",
+                 " set end_reason.",
                  conn->marked_for_close_file, conn->marked_for_close);
       }
       control_event_stream_status(edge_conn, STREAM_EVENT_CLOSED,
@@ -2385,7 +2384,7 @@ assert_connection_ok(connection_t *conn, time_t now)
   if (conn->hold_open_until_flushed)
     tor_assert(conn->marked_for_close);
 
-  /* XXXX012 check: wants_to_read, wants_to_write, s, conn_array_index,
+  /* XXXX check: wants_to_read, wants_to_write, s, conn_array_index,
    * marked_for_close. */
 
   /* buffers */
@@ -2394,7 +2393,7 @@ assert_connection_ok(connection_t *conn, time_t now)
     assert_buf_ok(conn->outbuf);
   }
 
-  /* XXXX012 Fix this; no longer so.*/
+  /* XXXX Fix this; no longer so.*/
 #if 0
   if (conn->type != CONN_TYPE_OR && conn->type != CONN_TYPE_DIR)
     tor_assert(!conn->pkey);

+ 13 - 10
src/or/dns.c

@@ -320,20 +320,12 @@ void
 dns_free_all(void)
 {
   cached_resolve_t **ptr, **next, *item;
+  assert_cache_ok();
   if (cached_resolve_pqueue) {
     SMARTLIST_FOREACH(cached_resolve_pqueue, cached_resolve_t *, res,
       {
-        /* XXXX012 The hash lookups here could be quite slow; remove them
-         * once we're happy. (Leave them in for at least 0.1.2.7-alpha, so they
-         * get some testing.) -NM */
-        if (res->state == CACHE_STATE_DONE) {
-          cached_resolve_t *found = HT_FIND(cache_map, &cache_root, res);
-          tor_assert(!found || found != res);
+        if (res->state == CACHE_STATE_DONE)
           _free_cached_resolve(res);
-        } else {
-          cached_resolve_t *found = HT_FIND(cache_map, &cache_root, res);
-          tor_assert(found);
-        }
       });
   }
   for (ptr = HT_START(cache_map, &cache_root); ptr != NULL; ptr = next) {
@@ -2032,6 +2024,17 @@ _assert_cache_ok(void)
 
   smartlist_pqueue_assert_ok(cached_resolve_pqueue,
                              _compare_cached_resolves_by_expiry);
+
+  SMARTLIST_FOREACH(cached_resolve_pqueue, cached_resolve_t *, res,
+    {
+      if (res->state == CACHE_STATE_DONE) {
+        cached_resolve_t *found = HT_FIND(cache_map, &cache_root, res);
+        tor_assert(!found || found != res);
+      } else {
+        cached_resolve_t *found = HT_FIND(cache_map, &cache_root, res);
+        tor_assert(found);
+      }
+    });
 }
 #endif
 

+ 0 - 6
src/or/or.h

@@ -1610,8 +1610,6 @@ typedef struct {
   int DirAllowPrivateAddresses;
   char *User; /**< Name of user to run Tor as. */
   char *Group; /**< Name of group to run Tor as. */
-  double PathlenCoinWeight; /**< Parameter used to configure average path
-                             * length (alpha in geometric distribution). */
   int ORPort; /**< Port to listen on for OR connections. */
   int SocksPort; /**< Port to listen on for SOCKS connections. */
   /** Port to listen on for transparent pf/netfilter connections. */
@@ -1683,10 +1681,6 @@ typedef struct {
                             * to use in a second? */
   uint64_t MaxAdvertisedBandwidth; /**< How much bandwidth are we willing to
                                     * tell people we have? */
-  uint64_t RelayBandwidthRate; /**< How much bandwidth, on average, are we
-                                 * willing to use for all relayed conns? */
-  uint64_t RelayBandwidthBurst; /**< How much bandwidth, at maximum, will we
-                                 * use in a second for all relayed conns? */
   int NumCpus; /**< How many CPUs should we try to use? */
   int RunTesting; /**< If true, create testing circuits to measure how well the
                    * other ORs are running. */