summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-10-25 12:25:41 -0400
committerNick Mathewson <nickm@torproject.org>2017-10-25 12:25:41 -0400
commitc7a1a987d6dfcb65a5fd639cc3d37b76809c37d5 (patch)
treec817ec6a66adeca56bf848ea77a695478e35ab3c
parent55a3dad7083ae9931e9ca760fd6c27c5de3b8986 (diff)
parent9592797cf3291fceb7715164e519e02a744c2a25 (diff)
downloadtor-c7a1a987d6dfcb65a5fd639cc3d37b76809c37d5.tar.gz
tor-c7a1a987d6dfcb65a5fd639cc3d37b76809c37d5.zip
Merge branch 'maint-0.3.2'
-rw-r--r--changes/bug237906
-rw-r--r--src/or/rendservice.c28
2 files changed, 34 insertions, 0 deletions
diff --git a/changes/bug23790 b/changes/bug23790
new file mode 100644
index 0000000000..5ebe77f806
--- /dev/null
+++ b/changes/bug23790
@@ -0,0 +1,6 @@
+ o Minor bugfixes (hidden service v2):
+ - When reloading tor (HUP) configured with hidden service(s), some
+ information weren't copy to the new service object. One problem with
+ this was that tor would wait at least the RendPostPeriod time before
+ uploading the descriptor if the reload happened before the descriptor
+ needed to be published. Fixes bug 23790; bugfix on 0.2.1.9-alpha.
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index 74646c78d1..60234a5c1f 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -475,6 +475,30 @@ rend_service_port_config_free(rend_service_port_config_t *p)
tor_free(p);
}
+/* Copy relevant data from service src to dst while pruning the service lists.
+ * This should only be called during the pruning process which takes existing
+ * services and copy their data to the newly configured services. The src
+ * service replaycache will be set to NULL after this call. */
+static void
+copy_service_on_prunning(rend_service_t *dst, rend_service_t *src)
+{
+ tor_assert(dst);
+ tor_assert(src);
+
+ /* Keep the timestamps for when the content changed and the next upload
+ * time so we can properly upload the descriptor if needed for the new
+ * service object. */
+ dst->desc_is_dirty = src->desc_is_dirty;
+ dst->next_upload_time = src->next_upload_time;
+ /* Move the replaycache to the new object. */
+ dst->accepted_intro_dh_parts = src->accepted_intro_dh_parts;
+ src->accepted_intro_dh_parts = NULL;
+ /* Copy intro point information to destination service. */
+ dst->intro_period_started = src->intro_period_started;
+ dst->n_intro_circuits_launched = src->n_intro_circuits_launched;
+ dst->n_intro_points_wanted = src->n_intro_points_wanted;
+}
+
/* Helper: Actual implementation of the pruning on reload which we've
* decoupled in order to make the unit test workeable without ugly hacks.
* Furthermore, this function does NOT free any memory but will nullify the
@@ -548,6 +572,10 @@ rend_service_prune_list_impl_(void)
smartlist_clear(old->intro_nodes);
smartlist_add_all(new->expiring_nodes, old->expiring_nodes);
smartlist_clear(old->expiring_nodes);
+
+ /* Copy needed information from old to new. */
+ copy_service_on_prunning(new, old);
+
/* This regular service will survive the closing IPs step after. */
smartlist_add(surviving_services, old);
break;