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.
This commit is contained in:
Donncha O'Cearbhaill 2015-08-04 14:47:51 +02:00
parent 0bd68bf986
commit 293410d138
3 changed files with 10 additions and 5 deletions

View File

@ -6255,10 +6255,12 @@ get_desc_id_from_query(const rend_data_t *rend_data, const char *hsdir_fp)
* *
* <b>service_id</b> is the descriptor onion address. * <b>service_id</b> is the descriptor onion address.
* <b>desc_id_base32</b> is the descriptor ID. * <b>desc_id_base32</b> is the descriptor ID.
* <b>replica</b> is the the descriptor replica number.
*/ */
void void
control_event_hs_descriptor_created(const char *service_id, 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) { if (!service_id || !desc_id_base32) {
log_warn(LD_BUG, "Called with service_digest==%p, " 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, 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, service_id,
desc_id_base32); desc_id_base32,
replica);
} }
/** send HS_DESC upload event. /** send HS_DESC upload event.

View File

@ -118,7 +118,8 @@ void control_event_hs_descriptor_requested(const rend_data_t *rend_query,
const char *desc_id_base32, const char *desc_id_base32,
const char *hs_dir); const char *hs_dir);
void control_event_hs_descriptor_created(const char *service_id, 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, void control_event_hs_descriptor_upload(const char *service_id,
const char *desc_id_base32, const char *desc_id_base32,
const char *hs_dir); const char *hs_dir);

View File

@ -661,7 +661,7 @@ rend_encode_v2_descriptors(smartlist_t *descs_out,
rend_cache_store_v2_desc_as_service(enc->desc_str); rend_cache_store_v2_desc_as_service(enc->desc_str);
base32_encode(service_id_base32, sizeof(service_id_base32), base32_encode(service_id_base32, sizeof(service_id_base32),
service_id, REND_SERVICE_ID_LEN); 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 " log_info(LD_REND, "Successfully encoded a v2 descriptor and "