Ticket #20082: 0001-Removed-initial-rendezvous-post-dealy-and-dead-code-.patch

File 0001-Removed-initial-rendezvous-post-dealy-and-dead-code-.patch, 3.4 KB (added by twim, 2 years ago)
  • src/or/rendservice.c

    From 4bea3f39861c7a305490dd0d0856e803f36366b3 Mon Sep 17 00:00:00 2001
    From: Ivan Markin <twim@riseup.net>
    Date: Tue, 11 Oct 2016 21:40:40 +0000
    Subject: [PATCH 1/2] Removed initial rendezvous post dealy and dead code from
     rend_consider_services_intro_points()
    
    ---
     src/or/rendservice.c | 39 +++++++++++----------------------------
     1 file changed, 11 insertions(+), 28 deletions(-)
    
    diff --git a/src/or/rendservice.c b/src/or/rendservice.c
    index 114a56b..869280a 100644
    a b rend_consider_services_intro_points(void) 
    39043904  smartlist_free(retry_nodes);
    39053905}
    39063906
    3907 #define MIN_REND_INITIAL_POST_DELAY (30)
    3908 #define MIN_REND_INITIAL_POST_DELAY_TESTING (5)
     3907#define REND_DIRTY_DESC_STABILIZING_PERIOD (3)
    39093908
    39103909/** Regenerate and upload rendezvous service descriptors for all
    39113910 * services, if necessary. If the descriptor has been dirty enough
    39123911 * for long enough, definitely upload; else only upload when the
    39133912 * periodic timeout has expired.
    39143913 *
    3915  * For the first upload, pick a random time between now and two periods
    3916  * from now, and pick it independently for each service.
     3914 * For the first upload, upload immediately.
    39173915 */
    39183916void
    39193917rend_consider_services_upload(time_t now)
    39203918{
    39213919  int i;
    39223920  rend_service_t *service;
    3923   const or_options_t *options = get_options();
    3924   int rendpostperiod = options->RendPostPeriod;
    3925   int rendinitialpostdelay = (options->TestingTorNetwork ?
    3926                               MIN_REND_INITIAL_POST_DELAY_TESTING :
    3927                               MIN_REND_INITIAL_POST_DELAY);
    3928 
     3921  time_t stabilizing_period = (time_t) REND_DIRTY_DESC_STABILIZING_PERIOD;
    39293922  for (i=0; i < smartlist_len(rend_service_list); ++i) {
    39303923    service = smartlist_get(rend_service_list, i);
    3931     if (!service->next_upload_time) { /* never been uploaded yet */
    3932       /* The fixed lower bound of rendinitialpostdelay seconds ensures that
    3933        * the descriptor is stable before being published. See comment below. */
    3934       service->next_upload_time =
    3935         now + rendinitialpostdelay + crypto_rand_int(2*rendpostperiod);
    3936       /* Single Onion Services prioritise availability over hiding their
    3937        * startup time, as their IP address is publicly discoverable anyway.
    3938        */
    3939       if (rend_service_reveal_startup_time(options)) {
    3940         service->next_upload_time = now + rendinitialpostdelay;
    3941       }
    3942     }
    39433924    /* Does every introduction points have been established? */
    39443925    unsigned int intro_points_ready =
    39453926      count_established_intro_points(service) >=
    39463927        service->n_intro_points_wanted;
    39473928    if (intro_points_ready &&
    3948         (service->next_upload_time < now ||
    3949         (service->desc_is_dirty &&
    3950          service->desc_is_dirty < now-rendinitialpostdelay))) {
    3951       /* if it's time, or if the directory servers have a wrong service
    3952        * descriptor and ours has been stable for rendinitialpostdelay seconds,
    3953        * upload a new one of each format. */
     3929        /* never been uploaded */
     3930        (!service->next_upload_time ||
     3931        /* it's time to upload */
     3932        service->next_upload_time < now ||
     3933        /* once uploaded and directory servers have a wrong service descriptor */
     3934        /* and ours has been stable for stablizing_period */
     3935        (service->next_upload_time && service->desc_is_dirty &&
     3936         service->desc_is_dirty < now - stabilizing_period))) {
    39543937      rend_service_update_descriptor(service);
    39553938      upload_service_descriptor(service);
    39563939    }