summaryrefslogtreecommitdiff
path: root/src/or/rendcommon.c
diff options
context:
space:
mode:
authorDonncha O'Cearbhaill <donncha@donncha.is>2015-07-29 15:20:51 +0200
committerDonncha O'Cearbhaill <donncha@donncha.is>2015-08-25 17:30:11 +0200
commite0b82e5968af50e649963f6833ac7fd6e70a7e42 (patch)
tree6be6958eaea0a71abae4f39a20b31f1b60da980a /src/or/rendcommon.c
parent968cb95602b38af626bc85e394fbfb499a59b76c (diff)
downloadtor-e0b82e5968af50e649963f6833ac7fd6e70a7e42.tar.gz
tor-e0b82e5968af50e649963f6833ac7fd6e70a7e42.zip
Store service descriptors in the service descriptor cache
Service descriptors are now generated regardless of the the PublishHidServDescriptors option. The generated descriptors are stored in the service descriptor cache. The PublishHidServDescriptors = 1 option now prevents descriptor publication to the HSDirs rather than descriptor generation.
Diffstat (limited to 'src/or/rendcommon.c')
-rw-r--r--src/or/rendcommon.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c
index 22599e9830..1e040847cf 100644
--- a/src/or/rendcommon.c
+++ b/src/or/rendcommon.c
@@ -11,6 +11,7 @@
#include "or.h"
#include "circuitbuild.h"
#include "config.h"
+#include "control.h"
#include "rendclient.h"
#include "rendcommon.h"
#include "rendmid.h"
@@ -461,6 +462,7 @@ rend_encode_v2_descriptors(smartlist_t *descs_out,
smartlist_t *client_cookies)
{
char service_id[DIGEST_LEN];
+ char service_id_base32[REND_SERVICE_ID_LEN_BASE32+1];
uint32_t time_period;
char *ipos_base64 = NULL, *ipos = NULL, *ipos_encrypted = NULL,
*descriptor_cookie = NULL;
@@ -655,6 +657,11 @@ rend_encode_v2_descriptors(smartlist_t *descs_out,
goto err;
}
smartlist_add(descs_out, enc);
+ /* Add the uploaded descriptor to the local service's descriptor cache */
+ rend_cache_store_v2_desc_as_service(enc->desc_str);
+ base32_encode(service_id_base32, sizeof(service_id_base32),
+ service_id, REND_SERVICE_ID_LEN);
+ control_event_hs_descriptor_created(service_id_base32, desc_id_base32);
}
log_info(LD_REND, "Successfully encoded a v2 descriptor and "