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

Re: [tor-bugs] #11200 [Tor]: cached consensus inteferes with DisableNetwork=1



#11200: cached consensus inteferes with DisableNetwork=1
-------------------------+-------------------------------------------------
     Reporter:  mcs      |      Owner:
         Type:  defect   |     Status:  needs_review
     Priority:  major    |  Milestone:  Tor: 0.2.5.x-final
    Component:  Tor      |    Version:  Tor: 0.2.4.21
   Resolution:           |   Keywords:  tor-client, 024-backport,
Actual Points:           |  025-triaged, andrea-review-0254, tbb-tor-
       Points:           |  backported-3.6b2, TorBrowserTeam201408
                         |  Parent ID:
-------------------------+-------------------------------------------------

Comment (by arma):

 What would you think of a patch like this?
 {{{
 diff --git a/src/or/nodelist.c b/src/or/nodelist.c
 index 8f87081..998cd21 100644
 --- a/src/or/nodelist.c
 +++ b/src/or/nodelist.c
 @@ -1494,6 +1494,7 @@ update_router_have_minimum_dir_info(void)
  {
    time_t now = time(NULL);
    int res;
 +  static int disabled=0;
    const or_options_t *options = get_options();
    const networkstatus_t *consensus =
 networkstatus_get_reasonably_live_consensus(now,usable_consensus_flavor());
 @@ -1512,9 +1513,11 @@ update_router_have_minimum_dir_info(void)
    }

    if (should_delay_dir_fetches(get_options(), &delay_fetches_msg)) {
 -    log_notice(LD_DIR, "Delaying directory fetches: %s",
 delay_fetches_msg);
 +    if (!disabled)
 +      log_notice(LD_DIR, "Delaying directory fetches: %s",
 delay_fetches_msg);
      strlcpy(dir_info_status, delay_fetches_msg,
 sizeof(dir_info_status));
      res = 0;
 +    disabled = 1;
      goto done;
 +  } else {
 +    disabled = 0;
    }

 @@ -1566,6 +1569,7 @@ update_router_have_minimum_dir_info(void)
      control_event_client_status(LOG_NOTICE, "NOT_ENOUGH_DIR_INFO");
    }
    have_min_dir_info = res;
 -  need_to_update_have_min_dir_info = 0;
 +  if (!disabled)
 +    need_to_update_have_min_dir_info = 0;
  }
 }}}

 Basically we don't cache the answer if we're returning 0 because of
 should_delay_dir_fetches().

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/11200#comment:26>
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