[or-cvs] we were counting incorrectly when trying to figure out whet...

Roger Dingledine arma at seul.org
Wed Jul 21 03:16:26 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or

Modified Files:
	circuitbuild.c circuituse.c connection_edge.c 
Log Message:
we were counting incorrectly when trying to figure out whether
a given AP stream was being handled or not.
(how did this work?)


Index: circuitbuild.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuitbuild.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- circuitbuild.c	21 Jul 2004 02:25:14 -0000	1.14
+++ circuitbuild.c	21 Jul 2004 03:16:24 -0000	1.15
@@ -855,18 +855,14 @@
           carray[j]->marked_for_close ||
           circuit_stream_is_being_handled(carray[j]))
         continue; /* Skip everything but APs in CIRCUIT_WAIT */
-      switch (connection_ap_can_use_exit(carray[j], router))
-        {
-        case ADDR_POLICY_REJECTED:
-          log_fn(LOG_DEBUG,"%s (index %d) would reject this stream.",
-                 router->nickname, i);
-          break; /* would be rejected; try next connection */
-        case ADDR_POLICY_ACCEPTED:
-        case ADDR_POLICY_UNKNOWN:
-          ++n_supported[i];
-          log_fn(LOG_DEBUG,"%s is supported. n_supported[%d] now %d.",
-                 router->nickname, i, n_supported[i]);
-        }
+      if(connection_ap_can_use_exit(carray[j], router)) {
+        ++n_supported[i];
+        log_fn(LOG_DEBUG,"%s is supported. n_supported[%d] now %d.",
+               router->nickname, i, n_supported[i]);
+      } else {
+        log_fn(LOG_DEBUG,"%s (index %d) would reject this stream.",
+               router->nickname, i);
+      }
     } /* End looping over connections. */
     if (n_supported[i] > best_support) {
       /* If this router is better than previous ones, remember its index

Index: circuituse.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuituse.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- circuituse.c	18 Jul 2004 21:47:03 -0000	1.7
+++ circuituse.c	21 Jul 2004 03:16:24 -0000	1.8
@@ -82,7 +82,7 @@
       if (!strncmp(exitrouter->platform, "Tor 0.0.7", 9))
         return 0;
     } else if(purpose == CIRCUIT_PURPOSE_C_GENERAL) {
-      if(connection_ap_can_use_exit(conn, exitrouter) == ADDR_POLICY_REJECTED) {
+      if(!connection_ap_can_use_exit(conn, exitrouter)) {
         /* can't exit from this router */
         return 0;
       }
@@ -268,7 +268,7 @@
        (!circ->timestamp_dirty ||
         circ->timestamp_dirty + options.NewCircuitPeriod < now)) {
       exitrouter = router_get_by_digest(circ->build_state->chosen_exit_digest);
-      if(exitrouter && connection_ap_can_use_exit(conn, exitrouter) != ADDR_POLICY_REJECTED)
+      if(exitrouter && connection_ap_can_use_exit(conn, exitrouter))
         if(++num >= MIN_CIRCUITS_HANDLING_STREAM)
           return 1;
     }

Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_edge.c,v
retrieving revision 1.197
retrieving revision 1.198
diff -u -d -r1.197 -r1.198
--- connection_edge.c	21 Jul 2004 02:25:14 -0000	1.197
+++ connection_edge.c	21 Jul 2004 03:16:24 -0000	1.198
@@ -945,8 +945,10 @@
     return strncmp(exit->platform, "Tor 0.0.7", 9) ? 1 : 0;
   }
   addr = client_dns_lookup_entry(conn->socks_request->address);
-  return router_compare_addr_to_exit_policy(addr,
-           conn->socks_request->port, exit->exit_policy);
+  if(router_compare_addr_to_exit_policy(addr,
+     conn->socks_request->port, exit->exit_policy) < 0)
+    return 0;
+  return 1;
 }
 
 /** A helper function for socks_policy_permits_address() below.



More information about the tor-commits mailing list