[tor-bugs] #13223 [Tor]: Refactor rend_client_refetch_v2_renddesc()

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Sep 23 01:32:52 UTC 2014


#13223: Refactor rend_client_refetch_v2_renddesc()
-----------------------------+------------------------------------
 Reporter:  arma             |          Owner:
     Type:  defect           |         Status:  new
 Priority:  normal           |      Milestone:  Tor: 0.2.6.x-final
Component:  Tor              |        Version:
 Keywords:  SponsorR tor-hs  |  Actual Points:
Parent ID:                   |         Points:
-----------------------------+------------------------------------
 {{{
   /* Randomly iterate over the replicas until a descriptor can be fetched
    * from one of the consecutive nodes, or no options are left. */
   tries_left = REND_NUMBER_OF_NON_CONSECUTIVE_REPLICAS;
   for (i = 0; i < REND_NUMBER_OF_NON_CONSECUTIVE_REPLICAS; i++)
     replicas_left_to_try[i] = i;
   while (tries_left > 0) {
     int rand = crypto_rand_int(tries_left);
     int chosen_replica = replicas_left_to_try[rand];
     replicas_left_to_try[rand] = replicas_left_to_try[--tries_left];
     [...]
 }}}

 Wow.

 I don't know if there are bugs in there or not. I'm not even sure what
 it's trying to do. And since REND_NUMBER_OF_NON_CONSECUTIVE_REPLICAS is
 just 2, this sure could get simpler.

 It looks like it chooses one of two replicas to start, and then once it's
 picked those, it picks one of the three relays at that replica? Is that
 the same distribution as "pick one of the six hsdirs uniformly at random"?

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/13223>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list