Browse Source

Clean up some comments; remove some dead code

svn:r5493
Nick Mathewson 20 years ago
parent
commit
1b0134dda8
4 changed files with 10 additions and 16 deletions
  1. 3 2
      src/or/circuitbuild.c
  2. 4 12
      src/or/circuitlist.c
  3. 2 1
      src/or/circuituse.c
  4. 1 1
      src/or/connection_edge.c

+ 3 - 2
src/or/circuitbuild.c

@@ -411,8 +411,9 @@ circuit_n_conn_done(connection_t *or_conn, int status)
         continue;
         continue;
       }
       }
       debug(LD_CIRC,"Found circ %d, sending create cell.", circ->n_circ_id);
       debug(LD_CIRC,"Found circ %d, sending create cell.", circ->n_circ_id);
-      /* circuit_deliver_create_cell will set n_circ_id and add us to the
-       * index. */
+      /* circuit_deliver_create_cell will set n_circ_id and add us to
+       * orconn_circuid_circuit_map, so we don't need to call
+       * set_circid_orconn here. */
       circ->n_conn = or_conn;
       circ->n_conn = or_conn;
       memcpy(circ->n_conn_id_digest, or_conn->identity_digest, DIGEST_LEN);
       memcpy(circ->n_conn_id_digest, or_conn->identity_digest, DIGEST_LEN);
       if (CIRCUIT_IS_ORIGIN(circ)) {
       if (CIRCUIT_IS_ORIGIN(circ)) {

+ 4 - 12
src/or/circuitlist.c

@@ -132,8 +132,8 @@ circuit_set_circid_orconn(circuit_t *circ, uint16_t id,
   ++conn->n_circuits;
   ++conn->n_circuits;
 }
 }
 
 
-/** Add <b>circ</b> to the list of circuits waiting for us to connect to
- * an OR. */
+/** Change the state of <b>circ</b> to <b>state</b>, adding it to or removing
+ * it from lists as appropriate. */
 void
 void
 circuit_set_state(circuit_t *circ, int state)
 circuit_set_state(circuit_t *circ, int state)
 {
 {
@@ -142,9 +142,8 @@ circuit_set_state(circuit_t *circ, int state)
     return;
     return;
   if (circ->state == CIRCUIT_STATE_OR_WAIT) {
   if (circ->state == CIRCUIT_STATE_OR_WAIT) {
     /* remove from waiting-circuit list. */
     /* remove from waiting-circuit list. */
-    if (!circuits_pending_or_conns)
-      circuits_pending_or_conns = smartlist_create();
-    smartlist_remove(circuits_pending_or_conns, circ);
+    if (circuits_pending_or_conns)
+      smartlist_remove(circuits_pending_or_conns, circ);
   }
   }
   if (state == CIRCUIT_STATE_OR_WAIT) {
   if (state == CIRCUIT_STATE_OR_WAIT) {
     /* add to waiting-circuit list. */
     /* add to waiting-circuit list. */
@@ -155,13 +154,6 @@ circuit_set_state(circuit_t *circ, int state)
   circ->state = state;
   circ->state = state;
 }
 }
 
 
-/** Remove <b>circ</b> from the list of circuits waiting for us to connect to
- * an OR. */
-void
-circuit_clear_state_orwait(circuit_t *circ)
-{
-}
-
 /** Add <b>circ</b> to the global list of circuits. This is called only from
 /** Add <b>circ</b> to the global list of circuits. This is called only from
  * within circuit_new.
  * within circuit_new.
  */
  */

+ 2 - 1
src/or/circuituse.c

@@ -230,7 +230,8 @@ circuit_expire_building(time_t now)
         case CIRCUIT_PURPOSE_REND_ESTABLISHED:
         case CIRCUIT_PURPOSE_REND_ESTABLISHED:
           /* OR-side. We can't actually reach this point because of the
           /* OR-side. We can't actually reach this point because of the
            * IS_ORIGIN test above. */
            * IS_ORIGIN test above. */
-          continue;
+          continue; /* yes, continue inside a switch refers to the nearest
+                     * enclosing loop. C is smart. */
         case CIRCUIT_PURPOSE_C_ESTABLISH_REND:
         case CIRCUIT_PURPOSE_C_ESTABLISH_REND:
         case CIRCUIT_PURPOSE_C_INTRODUCING:
         case CIRCUIT_PURPOSE_C_INTRODUCING:
         case CIRCUIT_PURPOSE_S_ESTABLISH_INTRO:
         case CIRCUIT_PURPOSE_S_ESTABLISH_INTRO:

+ 1 - 1
src/or/connection_edge.c

@@ -424,7 +424,7 @@ connection_ap_detach_retriable(connection_t *conn, circuit_t *circ)
 }
 }
 
 
 /** A client-side struct to remember requests to rewrite addresses
 /** A client-side struct to remember requests to rewrite addresses
- * to new addresses. These structs are stored the hash table
+ * to new addresses. These structs are stored in the hash table
  * "addressmap" below.
  * "addressmap" below.
  *
  *
  * There are 5 ways to set an address mapping:
  * There are 5 ways to set an address mapping: