Ticket #2355: tor-05-early_descriptor_refetch_with_bridges.patch

File tor-05-early_descriptor_refetch_with_bridges.patch, 2.0 KB (added by anonym, 8 years ago)

Schedule descriptor refetches immediately after changing bridge settings.

  • src/or/config.c

    diff --git a/src/or/config.c b/src/or/config.c
    index d093932..d79d71f 100644
    a b options_act(or_options_t *old_options) 
    14911491    }
    14921492  }
    14931493
     1494  /* Fetch bridge descriptors for any new bridges we've configured. */
     1495  if (options->EffectiveUseBridges && configured_bridges_changed) {
     1496    log_info(LD_CONFIG, "New bridges configured, "
     1497                        "fetching bridge descriptors.");
     1498    schedule_early_descriptor_refetch(); 
     1499  }
     1500
    14941501  /* Load the webpage we're going to serve every time someone asks for '/' on
    14951502     our DirPort. */
    14961503  tor_free(global_dirfrontpagecontents);
  • src/or/main.c

    diff --git a/src/or/main.c b/src/or/main.c
    index cd73917..7339a16 100644
    a b signewnym_impl(time_t now) 
    10311031  signewnym_is_pending = 0;
    10321032}
    10331033
     1034/** True iff we should retry fetching descriptors earlier than scheduled.
     1035 */
     1036static int early_descriptor_refetch = 0;
     1037
     1038/** Reschedule a descriptor refetch to be done as soon as possible.
     1039  */
     1040void
     1041schedule_early_descriptor_refetch(void)
     1042{
     1043  early_descriptor_refetch = 1;
     1044}
     1045
    10341046/** Perform regular maintenance tasks.  This function gets run once per
    10351047 * second by second_elapsed_callback().
    10361048 */
    run_scheduled_events(time_t now) 
    11071119      router_upload_dir_desc_to_dirservers(0);
    11081120  }
    11091121
    1110   if (time_to_try_getting_descriptors < now) {
     1122  if (time_to_try_getting_descriptors < now ||
     1123      early_descriptor_refetch) {
     1124    early_descriptor_refetch = 0;
    11111125    update_all_descriptor_downloads(now);
    11121126    update_extrainfo_downloads(now);
    11131127    if (options->EffectiveUseBridges)
  • src/or/main.h

    diff --git a/src/or/main.h b/src/or/main.h
    index db97cf1..cbf372e 100644
    a b void connection_stop_reading_from_linked_conn(connection_t *conn); 
    4848void directory_all_unreachable(time_t now);
    4949void directory_info_has_arrived(time_t now, int from_cache);
    5050
     51void schedule_early_descriptor_refetch(void);
     52
    5153void ip_address_changed(int at_interface);
    5254void dns_servers_relaunch_checks(void);
    5355