[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #2210 [Tor Relay]: Stream starvation due to activation order in circuit_resume_edge_reading_helper()



#2210: Stream starvation due to activation order in
circuit_resume_edge_reading_helper()
-----------------------+----------------------------------------------------
 Reporter:  nickm      |       Owner:  nickm             
     Type:  defect     |      Status:  needs_review      
 Priority:  normal     |   Milestone:  Tor: 0.2.2.x-final
Component:  Tor Relay  |     Version:                    
 Keywords:  fairness   |      Parent:  #1298             
-----------------------+----------------------------------------------------

Comment(by nickm):

 Initial review:
   * Windows doesn't have random(); you need to use rand() there instead
   * The "choose a random element" algorithm is a little nontrivial.  We
 already loop through all the streams earlier in the function, I think; we
 could accumulate a num_streams there, and just do a "first_stream_idx =
 random() % num_streams;"
   * Having an n_streams and a num_streams in the same function is
 confusing.
   * Duplicating the code in the two versions of the loop is a little iffy.
 It might be better to lift it into a function or something.  Duplicated
 code is prone to get out-of-sync.

 This is all stuff we could fix up trivially, and we shouldn't block
 waiting for a revised patch, unless Ian or Mashael really wants to do one.

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/2210#comment:3>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs