Ticket #20082: 0002-Show-a-warning-if-3-seconds-is-way-too-small-for-ser.patch

File 0002-Show-a-warning-if-3-seconds-is-way-too-small-for-ser.patch, 2.4 KB (added by twim, 2 years ago)
  • src/or/rendservice.c

    From 1002c04906fc9d52c79913b97e619700054fee07 Mon Sep 17 00:00:00 2001
    From: Ivan Markin <twim@riseup.net>
    Date: Tue, 11 Oct 2016 22:17:34 +0000
    Subject: [PATCH 2/2] Show a warning if 3 seconds is way too small for service
     descriptor to stabilize
    
    ---
     src/or/rendservice.c | 11 +++++++++++
     src/or/rendservice.h |  2 ++
     2 files changed, 13 insertions(+)
    
    diff --git a/src/or/rendservice.c b/src/or/rendservice.c
    index 869280a..2bdc7e0 100644
    a b rend_consider_services_upload(time_t now) 
    39193919  int i;
    39203920  rend_service_t *service;
    39213921  time_t stabilizing_period = (time_t) REND_DIRTY_DESC_STABILIZING_PERIOD;
     3922  time_t old_stabilizing_period = (time_t) 30;
    39223923  for (i=0; i < smartlist_len(rend_service_list); ++i) {
    39233924    service = smartlist_get(rend_service_list, i);
     3925    if (service->desc_is_dirty && service->last_upload_time) {
     3926      time_t was_stable_for = service->desc_is_dirty - service->last_upload_time;
     3927      if (stabilizing_period < was_stable_for &&
     3928          was_stable_for < old_stabilizing_period)
     3929        log_warn(LD_REND, "Service descriptor of %s has changed soon \
     3930                           after stabilizing period. Probably new stabilizing period \
     3931                           is too short.",
     3932                 safe_str_client(service->service_id));
     3933    }
    39243934    /* Does every introduction points have been established? */
    39253935    unsigned int intro_points_ready =
    39263936      count_established_intro_points(service) >=
    rend_consider_services_upload(time_t now) 
    39363946         service->desc_is_dirty < now - stabilizing_period))) {
    39373947      rend_service_update_descriptor(service);
    39383948      upload_service_descriptor(service);
     3949      service->last_upload_time = now;
    39393950    }
    39403951  }
    39413952}
  • src/or/rendservice.h

    diff --git a/src/or/rendservice.h b/src/or/rendservice.h
    index 630191e..d164b72 100644
    a b typedef struct rend_service_t { 
    9797  time_t desc_is_dirty; /**< Time at which changes to the hidden service
    9898                         * descriptor content occurred, or 0 if it's
    9999                         * up-to-date. */
     100  time_t last_upload_time; /**< Last time hidden service descriptor has
     101                            * been uploaded. */
    100102  time_t next_upload_time; /**< Scheduled next hidden service descriptor
    101103                            * upload time. */
    102104  /** Replay cache for Diffie-Hellman values of INTRODUCE2 cells, to