From 293410d1384742fe0da2f760707e3a282f4056b2 Mon Sep 17 00:00:00 2001 From: Donncha O'Cearbhaill Date: Tue, 4 Aug 2015 14:47:51 +0200 Subject: [PATCH] Add replica number to HS_DESC CREATED event Including the replica number in the HS_DESC CREATED event provides more context to a control port client. The replica allows clients to more easily identify each replicated descriptor from the independantly output control events. --- src/or/control.c | 10 +++++++--- src/or/control.h | 3 ++- src/or/rendcommon.c | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/or/control.c b/src/or/control.c index c2240bf38c..2408793bd7 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -6255,10 +6255,12 @@ get_desc_id_from_query(const rend_data_t *rend_data, const char *hsdir_fp) * * service_id is the descriptor onion address. * desc_id_base32 is the descriptor ID. + * replica is the the descriptor replica number. */ void control_event_hs_descriptor_created(const char *service_id, - const char *desc_id_base32) + const char *desc_id_base32, + int replica) { if (!service_id || !desc_id_base32) { log_warn(LD_BUG, "Called with service_digest==%p, " @@ -6267,9 +6269,11 @@ control_event_hs_descriptor_created(const char *service_id, } send_control_event(EVENT_HS_DESC, - "650 HS_DESC CREATED %s UNKNOWN UNKNOWN %s\r\n", + "650 HS_DESC CREATED %s UNKNOWN UNKNOWN %s " + "REPLICA=%d\r\n", service_id, - desc_id_base32); + desc_id_base32, + replica); } /** send HS_DESC upload event. diff --git a/src/or/control.h b/src/or/control.h index 26f7f50b88..1f8e2bcdc6 100644 --- a/src/or/control.h +++ b/src/or/control.h @@ -118,7 +118,8 @@ void control_event_hs_descriptor_requested(const rend_data_t *rend_query, const char *desc_id_base32, const char *hs_dir); void control_event_hs_descriptor_created(const char *service_id, - const char *desc_id_base32); + const char *desc_id_base32, + int replica); void control_event_hs_descriptor_upload(const char *service_id, const char *desc_id_base32, const char *hs_dir); diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c index 1e040847cf..f9d47d13f5 100644 --- a/src/or/rendcommon.c +++ b/src/or/rendcommon.c @@ -661,7 +661,7 @@ rend_encode_v2_descriptors(smartlist_t *descs_out, 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); + control_event_hs_descriptor_created(service_id_base32, desc_id_base32, k); } log_info(LD_REND, "Successfully encoded a v2 descriptor and "