[or-cvs] [tor/release-0.2.2 138/162] Fix whitespace in patch for 2210 and backport to 0.2.2

arma at torproject.org arma at torproject.org
Mon Dec 20 03:06:41 UTC 2010


Author: Nick Mathewson <nickm at torproject.org>
Date: Mon, 29 Nov 2010 15:53:12 -0500
Subject: Fix whitespace in patch for 2210 and backport to 0.2.2
Commit: 0eafe23ff38dd895c15b2deba70e5df997cf97e9

---
 src/or/relay.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/or/relay.c b/src/or/relay.c
index 7b618ba..8a4edb9 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -1515,9 +1515,12 @@ circuit_resume_edge_reading_helper(edge_connection_t *first_conn,
 
   /* Select a stream uniformly at random from the linked list.  We
    * don't need cryptographic randomness here. */
-  for(conn = first_conn; conn; conn = conn->next_stream) {
+  for (conn = first_conn; conn; conn = conn->next_stream) {
     num_streams++;
-    if((random() % num_streams)==0) chosen_stream = conn;
+    if ((random() % num_streams)==0)
+      chosen_stream = conn;
+    /* Invariant: chosen_stream has been chosen uniformly at random from among
+     * the first num_streams streams on first_conn. */
   }
   /* Activate reading starting from the chosen stream */
   for (conn=chosen_stream; conn; conn = conn->next_stream) {
@@ -1525,14 +1528,14 @@ circuit_resume_edge_reading_helper(edge_connection_t *first_conn,
     if (conn->_base.marked_for_close || conn->package_window <= 0)
       continue;
     if (!layer_hint || conn->cpath_layer == layer_hint) {
-      connection_start_reading(TO_CONN(conn));    
+      connection_start_reading(TO_CONN(conn));
 
-      if (connection_get_inbuf_len(TO_CONN(conn)) > 0)
+      if (buf_datalen(conn->_base.inbuf) > 0)
         ++n_streams;
     }
   }
   /* Go back and do the ones we skipped, circular-style */
-  for(conn = first_conn; conn != chosen_stream; conn = conn->next_stream) {
+  for (conn = first_conn; conn != chosen_stream; conn = conn->next_stream) {
     if (conn->_base.marked_for_close || conn->package_window <= 0)
       continue;
     if (!layer_hint || conn->cpath_layer == layer_hint) {
-- 
1.7.1




More information about the tor-commits mailing list