Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
Trac
Trac
  • Project overview
    • Project overview
    • Details
    • Activity
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Operations
    • Operations
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Create a new issue
  • Issue Boards

GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

  • Legacy
  • TracTrac
  • Issues
  • #25914

Closed (moved)
Open
Opened Apr 25, 2018 by David Goulet@dgoulet🐋

dirserv: Remove dead code

While working on #25610 (moved), I've noticed dead code that uses dirserv_get_consensus().

In networkstatus.c, function networkstatus_set_current_consensus():

We parse the flavor and if it is unknown, we bail early with:

  if (flav < 0) {
    /* XXXX we don't handle unrecognized flavors yet. */
    log_warn(LD_BUG, "Unrecognized consensus flavor %s", flavor);
    return -2;
  }

But later in the function we have this if/else on the flavor name with a else {} statement that uses dirserv_get_consensus(). But we can't get into that else case since the first conditions are the only two flavors we can handle.

In between the first checks above and this if/else ^, the flavor can change as in we take the one from the given consensus but again, there is a check on if we can handle that flavor:

  if (flav != usable_consensus_flavor() &&
      !we_want_to_fetch_flavor(options, flav)) {

Bottom line, I think the else {} code is dead code. This simplifies the callgraph into the dirauth subsystem.

To upload designs, you'll need to enable LFS and have admin enable hashed storage. More information
Assignee
Assign to
Tor: 0.3.4.x-final
Milestone
Tor: 0.3.4.x-final
Assign milestone
Time tracking
None
Due date
None
Reference: legacy/trac#25914