Skip to content
Snippets Groups Projects
Closed count_acceptable_nodes() would be more accurate using node_has_preferred_descriptor()
  • View options
  • count_acceptable_nodes() would be more accurate using node_has_preferred_descriptor()

  • View options
  • Closed Issue created by Nick Mathewson

    On a github review for legacy/trac#25691 (moved), Teor notes about count_acceptable_nodes():

    I think this code is correct, but it's not obvious:

    1. new_route_len() is the only caller
    2. new_route_len() will fail if count_acceptable_nodes() is less than the route length.
    3. later functions will fail if there is no guard
    4. later functions will fail if there are not enough subsequent nodes for the rest of the route

    So this check can spuriously succeed when we have no guards, or when we have many bridges, and no subsequent nodes. But it can never fail when there are actually enough nodes for the path. So this is just an optimisation to stop us trying to build lots of circuits when we have no descriptors.

    We could return the number that pass for_direct_connect = 1 and for_direct_connect = 0, but that seems unnecessarily complicated.

    I think that we should probably adjust this function to do the careful count, but it's safe to defer.

    Linked items ... 0

  • Activity

    • All activity
    • Comments only
    • History only
    • Newest first
    • Oldest first
    Loading Loading Loading Loading Loading Loading Loading Loading Loading Loading