diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 67bdfff8c2..f542804d20 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -411,8 +411,9 @@ circuit_n_conn_done(connection_t *or_conn, int status)
continue;
}
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;
memcpy(circ->n_conn_id_digest, or_conn->identity_digest, DIGEST_LEN);
if (CIRCUIT_IS_ORIGIN(circ)) {
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index ba58c71d2a..8fceae19f6 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -132,8 +132,8 @@ circuit_set_circid_orconn(circuit_t *circ, uint16_t id,
++conn->n_circuits;
}
-/** Add circ to the list of circuits waiting for us to connect to
- * an OR. */
+/** Change the state of circ to state, adding it to or removing
+ * it from lists as appropriate. */
void
circuit_set_state(circuit_t *circ, int state)
{
@@ -142,9 +142,8 @@ circuit_set_state(circuit_t *circ, int state)
return;
if (circ->state == CIRCUIT_STATE_OR_WAIT) {
/* 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) {
/* add to waiting-circuit list. */
@@ -155,13 +154,6 @@ circuit_set_state(circuit_t *circ, int state)
circ->state = state;
}
-/** Remove circ from the list of circuits waiting for us to connect to
- * an OR. */
-void
-circuit_clear_state_orwait(circuit_t *circ)
-{
-}
-
/** Add circ to the global list of circuits. This is called only from
* within circuit_new.
*/
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index 308dbc2e53..c1a745e929 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -230,7 +230,8 @@ circuit_expire_building(time_t now)
case CIRCUIT_PURPOSE_REND_ESTABLISHED:
/* OR-side. We can't actually reach this point because of the
* 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_INTRODUCING:
case CIRCUIT_PURPOSE_S_ESTABLISH_INTRO:
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 0764e255e3..94113f52fc 100644
--- a/src/or/connection_edge.c
+++ b/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
- * to new addresses. These structs are stored the hash table
+ * to new addresses. These structs are stored in the hash table
* "addressmap" below.
*
* There are 5 ways to set an address mapping: