[tor-bugs] #18918 [Core Tor/Tor]: Clarify directory and ORPort checking functions

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Jan 23 11:49:46 UTC 2018


#18918: Clarify directory and ORPort checking functions
-------------------------------------------------+-------------------------
 Reporter:  teor                                 |          Owner:  (none)
     Type:  defect                               |         Status:  new
 Priority:  Medium                               |      Milestone:  Tor:
                                                 |  unspecified
Component:  Core Tor/Tor                         |        Version:  Tor:
                                                 |  0.2.8.1-alpha
 Severity:  Normal                               |     Resolution:
 Keywords:  easy, doc, code, refactor            |  Actual Points:
  technical-debt tor-relay                       |
Parent ID:                                       |         Points:
 Reviewer:                                       |        Sponsor:
-------------------------------------------------+-------------------------

Comment (by ffmancera):

 I have been reviewing the code these days. I don't think we should rename
 any function but I want to propose some changes in the code structure. I
 will list all the reviewed functions with my notes about them.

  * `check_whether_orport_reachable()` and
 `check_whether_dirport_reachable()`: I think they are fine, nice
 documentation and names.

  * `router_has_bandwidth_to_dirserver()`: Poor documentation, I already
 improved it a bit. Also I think we don't need to check
 `options->BandwidthRate < MIN_BW_TO_ADVERTISE_DIRSERVER` because we are
 checking the same on RelayBandwidthRate.

  * `router_should_be_directory()`: I don't think we need to check
 `advertising != new_choice` and then `new_choice == 1` because we
 initialize both to `1` and within the function only `new_choice` could
 turn into `0`. I already removed this if statement and it works correctly.

 * `dir_server_mode()` and `decide_to_advertise_dirport()`: I think they
 are fine, nice documentation and names.

 About combine functions, I think we could get
 `router_has_bandwidth_to_be_dirserv` into `router_should_be_directory`.
 Let's decide about do or not these changes and I will work on them :-)

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


More information about the tor-bugs mailing list