Browse Source

Remove code that has been #if-0ed for a long time.

svn:r4435
Nick Mathewson 20 years ago
parent
commit
d4972bd2e1
9 changed files with 1 additions and 134 deletions
  1. 0 16
      src/common/crypto.c
  2. 0 6
      src/or/circuitbuild.c
  3. 0 26
      src/or/config.c
  4. 0 7
      src/or/connection.c
  5. 1 0
      src/or/connection_edge.c
  6. 0 16
      src/or/dirserv.c
  7. 0 4
      src/or/or.h
  8. 0 38
      src/or/rephist.c
  9. 0 21
      src/or/routerparse.c

+ 0 - 16
src/common/crypto.c

@@ -1237,22 +1237,6 @@ static void init_dh_param(void) {
   tor_assert(p);
   tor_assert(g);
 
-#if 0
-  /* This is from draft-ietf-ipsec-ike-modp-groups-05.txt.  It's a safe
-     prime, and supposedly it equals:
-      2^1536 - 2^1472 - 1 + 2^64 * { [2^1406 pi] + 741804 }
-  */
-  r = BN_hex2bn(&p,
-                "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1"
-                "29024E088A67CC74020BBEA63B139B22514A08798E3404DD"
-                "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245"
-                "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED"
-                "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D"
-                "C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F"
-                "83655D23DCA3AD961C62F356208552BB9ED529077096966D"
-                "670C354E4ABC9804F1746C08CA237327FFFFFFFFFFFFFFFF");
-#endif
-
   /* This is from rfc2409, section 6.2.  It's a safe prime, and
      supposedly it equals:
         2^1024 - 2^960 - 1 + 2^64 * { [2^894 pi] + 129093 }.

+ 0 - 6
src/or/circuitbuild.c

@@ -899,12 +899,6 @@ new_route_len(double cw, uint8_t purpose, smartlist_t *routers)
     tor_fragile_assert();
     return -1;
   }
-#endif
-#if 0
-  for (routelen = 3; ; routelen++) { /* 3, increment until coinflip says we're done */
-    if (crypto_pseudo_rand_int(255) >= cw*255) /* don't extend */
-      break;
-  }
 #endif
   log_fn(LOG_DEBUG,"Chosen route length %d (%d routers available).",routelen,
          smartlist_len(routers));

+ 0 - 26
src/or/config.c

@@ -285,9 +285,6 @@ options_act(void)
   or_options_t *options = get_options();
   static int libevent_initialized = 0;
 
-  /* XXXX009 We once had a reason to separate start_daemon and finish_daemon:
-   *    It let us have the parent process stick around until we were sure Tor
-   *    was started.  Should we make start_daemon get called earlier? -NM */
   if (options->RunAsDaemon) {
     start_daemon();
   }
@@ -396,18 +393,6 @@ options_act(void)
     return -1;
   }
 
-#if 0
-  {
-    char *smin, *smax;
-    smin = config_dump_options(options, 1);
-    smax = config_dump_options(options, 0);
-    log_fn(LOG_DEBUG, "These are our options:\n%s",smax);
-    log_fn(LOG_DEBUG, "We changed these options:\n%s",smin);
-    tor_free(smin);
-    tor_free(smax);
-  }
-#endif
-
   /* Since our options changed, we might need to regenerate and upload our
    * server descriptor.  (We could probably be more clever about only calling
    * this when something significant changed.)
@@ -1502,11 +1487,6 @@ options_validate(or_options_t *options)
     log(LOG_WARN,"BandwidthBurst must be at least equal to BandwidthRate.");
     result = -1;
   }
-#if 0
-  if (2*options->BandwidthRate > options->BandwidthBurst) {
-    log(LOG_NOTICE,"You have chosen a BandwidthBurst less than twice BandwidthRate. Please consider setting your BandwidthBurst higher (at least %d), to provide better service to the Tor network.", (int)(2*options->BandwidthRate));
-  }
-#endif
 
   if (options->_MonthlyAccountingStart) {
     if (options->AccountingStart) {
@@ -2437,12 +2417,6 @@ validate_data_directory(or_options_t *options)
     log_fn(LOG_ERR, "DataDirectory is too long.");
     return -1;
   }
-#if 0
-  if (check_private_dir(options->DataDirectory, CPD_CHECK != 0)) {
-    log_fn(LOG_WARN, "Can't create directory %s", options->DataDirectory);
-    return -1;
-  }
-#endif
   return 0;
 }
 

+ 0 - 7
src/or/connection.c

@@ -1792,13 +1792,6 @@ assert_connection_ok(connection_t *conn, time_t now)
     assert_buf_ok(conn->outbuf);
   }
 
-#if 0 /* computers often go back in time; no way to know */
-  tor_assert(!now || conn->timestamp_lastread <= now);
-  tor_assert(!now || conn->timestamp_lastwritten <= now);
-  tor_assert(conn->timestamp_created <= conn->timestamp_lastread);
-  tor_assert(conn->timestamp_created <= conn->timestamp_lastwritten);
-#endif
-
   /* XXX Fix this; no longer so.*/
 #if 0
   if (conn->type != CONN_TYPE_OR && conn->type != CONN_TYPE_DIR)

+ 1 - 0
src/or/connection_edge.c

@@ -810,6 +810,7 @@ addressmap_register_virtual_address(int type, char *new_address)
 
 #if 0
   {
+    /* Try to catch possible bugs */
     addressmap_entry_t *ent;
     ent = strmap_get(addressmap, *addrp);
     tor_assert(ent);

+ 0 - 16
src/or/dirserv.c

@@ -211,22 +211,6 @@ dirserv_get_nickname_by_digest(const char *digest)
   return NULL;
 }
 
-#if 0
-/** Return true iff any router named <b>nickname</b> with <b>digest</b>
- * is in the verified fingerprint list. */
-static int
-router_nickname_is_approved(const char *nickname, const char *digest)
-{
-  const char *n;
-
-  n = dirserv_get_nickname_by_digest(digest);
-  if (n && !strcasecmp(n,nickname))
-    return 1;
-  else
-    return 0;
-}
-#endif
-
 /** Clear the current fingerprint list. */
 void
 dirserv_free_fingerprint_list()

+ 0 - 4
src/or/or.h

@@ -251,10 +251,6 @@ typedef enum {
 /** State for an exit connection: waiting to be removed. */
 #define EXIT_CONN_STATE_RESOLVEFAILED 4
 #define _EXIT_CONN_STATE_MAX 4
-#if 0
-#define EXIT_CONN_STATE_CLOSE 3 /* flushing the buffer, then will close */
-#define EXIT_CONN_STATE_CLOSE_WAIT 4 /* have sent a destroy, awaiting a confirmation */
-#endif
 
 /* the AP state values must be disjoint from the EXIT state values */
 #define _AP_CONN_STATE_MIN 5

+ 0 - 38
src/or/rephist.c

@@ -378,44 +378,6 @@ rep_history_clean(time_t before)
   }
 }
 
-#if 0
-void
-write_rep_history(const char *filename)
-{
-  FILE *f = NULL;
-  char *tmpfile;
-  int completed = 0;
-  or_history_t *or_history;
-  link_history_t *link_history;
-  strmap_iter_t *lhist_it;
-  strmap_iter_t *orhist_it;
-  void *or_history_p, *link_history_p;
-  const char *name1;
-
-  tmpfile = tor_malloc(strlen(filename)+5);
-  tor_snprintf(tmpfile, strlen(filename)+5, "%s_tmp", filename);
-
-  f = fopen(tmpfile, "w");
-  if (!f) goto done;
-  for (orhist_it = strmap_iter_init(history_map); !strmap_iter_done(orhist_it);
-       orhist_it = strmap_iter_next(history_map,orhist_it)) {
-    strmap_iter_get(orhist_it, &name1, &or_history_p);
-    or_history = (or_history_t*) or_history_p;
-    fprintf(f, "link %s connected:u%ld failed:%uld uptime:%uld",
-            name1, or_history->since1,
-  }
-
- done:
-  if (f)
-    fclose(f);
-  if (completed)
-    replace_file(filename, tmpfile);
-  else
-    unlink(tmpfile);
-  tor_free(tmpfile);
-}
-#endif
-
 #define NUM_SECS_ROLLING_MEASURE 10
 #define NUM_SECS_BW_SUM_IS_VALID (24*60*60) /* one day */
 #define NUM_SECS_BW_SUM_INTERVAL (15*60)

+ 0 - 21
src/or/routerparse.c

@@ -1389,27 +1389,6 @@ get_next_token(const char **s, where_syntax where)
 
  done_tokenizing:
 
-#if 0
-  for (i = 0; token_table[i].t ; ++i) {
-    if (token_table[i].v == tok->tp) {
-      fputs(token_table[i].t, stdout);
-      break;
-      i = -1;
-    }
-  }
-  if (i) {
-    if (tok->tp == _UNRECOGNIZED) fputs("UNRECOGNIZED", stdout);
-    if (tok->tp == _ERR) fputs("ERR",stdout);
-    if (tok->tp == _EOF) fputs("EOF",stdout);
-    if (tok->tp == _NIL) fputs("_NIL",stdout);
-  }
-  for (i = 0; i < tok->n_args; ++i) {
-    fprintf(stdout," \"%s\"", tok->args[i]);
-  }
-  if (tok->error) { fprintf(stdout," *%s*", tok->error); }
-  fputs("\n",stdout);
-#endif
-
   return tok;
 #undef RET_ERR
 }