diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index cd1e952d45..cdc0b65880 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -1097,11 +1097,6 @@ router_handles_some_port(routerinfo_t *router, smartlist_t *needed_ports)
return 0;
}
-/** How many circuits do we want simultaneously in-progress to handle
- * a given stream?
- */
-#define MIN_CIRCUITS_HANDLING_STREAM 2
-
static int
ap_stream_wants_exit_attention(connection_t *conn)
{
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index bc7d08736a..73e72f3e1e 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -168,8 +168,6 @@ circuit_get_best(edge_connection_t *conn, int must_be_open, uint8_t purpose,
purpose == CIRCUIT_PURPOSE_C_REND_JOINED);
for (circ=global_circuitlist;circ;circ = circ->next) {
- if (!CIRCUIT_IS_ORIGIN(circ))
- continue;
if (!circuit_is_acceptable(circ,conn,must_be_open,purpose,
need_uptime,need_internal,now))
continue;
@@ -281,7 +279,8 @@ circuit_remove_handled_ports(smartlist_t *needed_ports)
for (i = 0; i < smartlist_len(needed_ports); ++i) {
port = smartlist_get(needed_ports, i);
tor_assert(*port);
- if (circuit_stream_is_being_handled(NULL, *port, 2)) {
+ if (circuit_stream_is_being_handled(NULL, *port,
+ MIN_CIRCUITS_HANDLING_STREAM)) {
// log_debug(LD_CIRC,"Port %d is already being handled; removing.", port);
smartlist_del(needed_ports, i--);
tor_free(port);
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index d6f0ea5db1..c2a88ef548 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -430,8 +430,8 @@ connection_ap_expire_beginning(void)
} /* end for */
}
-/** Tell any AP streams that are waiting for a new circuit that one is
- * available.
+/** Tell any AP streams that are waiting for a new circuit to try again,
+ * either attaching to an available circ or launching a new one.
*/
void
connection_ap_attach_pending(void)
@@ -493,7 +493,7 @@ circuit_discard_optional_exit_enclaves(extend_info_t *info)
/** The AP connection conn has just failed while attaching or
* sending a BEGIN or resolving on circ, but another circuit
- * might work. Detach the circuit, and either reattach it, launch a
+ * might work. Detach the circuit, and either reattach it, launch a
* new circuit, tell the controller, or give up as a appropriate.
*
* Returns -1 on err, 1 on success, 0 on not-yet-sure.
@@ -1078,7 +1078,7 @@ addressmap_get_mappings(smartlist_t *sl, time_t min_expires,
* figure it out ourselves.
*
* First, parse whether it's a .exit address, remap it, and so on. Then
- * it's for a general circuit, try to attach it to a circuit (or launch
+ * if it's for a general circuit, try to attach it to a circuit (or launch
* one as needed), else if it's for a rendezvous circuit, fetch a
* rendezvous descriptor first (or attach/launch a circuit if the
* rendezvous descriptor is already here and fresh enough).
@@ -1505,9 +1505,10 @@ connection_ap_process_transparent(edge_connection_t *conn)
}
/** connection_edge_process_inbuf() found a conn in state
- * natd_wait. See if conn->inbuf has the right bytes to proceed.
+ * natd_wait. See if conn-\>inbuf has the right bytes to proceed.
* See libalias(3) and ProxyEncodeTcpStream() in alias_proxy.c for
* the encoding form of the original destination.
+ * XXX what is "alias_proxy.c"? -RD
*
* If the original destination is complete, send it to
* connection_ap_handshake_rewrite_and_attach().
diff --git a/src/or/control.c b/src/or/control.c
index 7d8aca3b98..cd761078f3 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -1733,7 +1733,7 @@ static const getinfo_item_t getinfo_items[] = {
"Time when the accounting period starts."),
ITEM("accounting/interval-end", accounting,
"Time when the accounting period ends."),
- ITEM("accounting/interval-warke", accounting,
+ ITEM("accounting/interval-wake", accounting,
"Time to wake up in this accounting period."),
/* deprecated */
ITEM("helper-nodes", entry_guards, NULL),
diff --git a/src/or/hibernate.c b/src/or/hibernate.c
index 774da51560..c0e6cf1b58 100644
--- a/src/or/hibernate.c
+++ b/src/or/hibernate.c
@@ -530,6 +530,7 @@ accounting_set_wakeup_time(void)
}
}
+/* This rounds 0 up to 1000, but that's actually a feature. */
#define ROUND_UP(x) (((x) + 0x3ff) & ~0x3ff)
#define BW_ACCOUNTING_VERSION 1
/** Save all our bandwidth tracking information to disk. Return 0 on
diff --git a/src/or/or.h b/src/or/or.h
index 2e885ad226..080c7f4ff0 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -445,6 +445,10 @@ typedef enum {
#define CIRCUIT_PURPOSE_IS_ORIGIN(p) ((p)>_CIRCUIT_PURPOSE_OR_MAX)
#define CIRCUIT_IS_ORIGIN(c) (CIRCUIT_PURPOSE_IS_ORIGIN((c)->purpose))
+/** How many circuits do we want simultaneously in-progress to handle
+ * a given stream? */
+#define MIN_CIRCUITS_HANDLING_STREAM 2
+
#define RELAY_COMMAND_BEGIN 1
#define RELAY_COMMAND_DATA 2
#define RELAY_COMMAND_END 3