Ver código fonte

some more cleanups and a bugfix on r9052

svn:r9062
Roger Dingledine 17 anos atrás
pai
commit
e206d22297
6 arquivos alterados com 14 adições e 14 exclusões
  1. 0 5
      src/or/circuitbuild.c
  2. 2 3
      src/or/circuituse.c
  3. 6 5
      src/or/connection_edge.c
  4. 1 1
      src/or/control.c
  5. 1 0
      src/or/hibernate.c
  6. 4 0
      src/or/or.h

+ 0 - 5
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)
 {

+ 2 - 3
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);

+ 6 - 5
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 <b>conn</b> has just failed while attaching or
  * sending a BEGIN or resolving on <b>circ</b>, 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().

+ 1 - 1
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),

+ 1 - 0
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

+ 4 - 0
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