commit 427b247c8d67baf2382755a3855f8ea380068107 Author: David Goulet dgoulet@torproject.org Date: Fri Nov 10 15:00:18 2017 -0500
hs-v3: Implement HS_DESC UPLOADED event
Signed-off-by: David Goulet dgoulet@torproject.org --- src/or/directory.c | 2 +- src/or/hs_control.c | 18 ++++++++++++++++++ src/or/hs_control.h | 4 ++++ 3 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/src/or/directory.c b/src/or/directory.c index a1d9c8c08..cbd7af075 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -3306,7 +3306,7 @@ handle_response_upload_hsdesc(dir_connection_t *conn, case 200: log_info(LD_REND, "Uploading hidden service descriptor: " "finished with status 200 (%s)", escaped(reason)); - /* XXX: Trigger control event. */ + hs_control_desc_event_uploaded(conn->hs_ident, conn->identity_digest); break; case 400: log_fn(LOG_PROTOCOL_WARN, LD_REND, diff --git a/src/or/hs_control.c b/src/or/hs_control.c index 09dbbeba4..fce6466ef 100644 --- a/src/or/hs_control.c +++ b/src/or/hs_control.c @@ -154,3 +154,21 @@ hs_control_desc_event_upload(const char *onion_address, DIGEST256_LEN)); }
+/* Send on the control port the "HS_DESC UPLOADED [...]" event. + * + * Using the directory connection identifier and the HSDir identity digest. + * None can be NULL. */ +void +hs_control_desc_event_uploaded(const hs_ident_dir_conn_t *ident, + const char *hsdir_id_digest) +{ + char onion_address[HS_SERVICE_ADDR_LEN_BASE32 + 1]; + + tor_assert(ident); + tor_assert(hsdir_id_digest); + + hs_build_address(&ident->identity_pk, HS_VERSION_THREE, onion_address); + + control_event_hs_descriptor_uploaded(hsdir_id_digest, onion_address); +} + diff --git a/src/or/hs_control.h b/src/or/hs_control.h index e10a300d7..de23dc73d 100644 --- a/src/or/hs_control.h +++ b/src/or/hs_control.h @@ -35,5 +35,9 @@ void hs_control_desc_event_upload(const char *onion_address, const ed25519_public_key_t *blinded_pk, const uint8_t *hsdir_index);
+/* Event "HS_DESC UPLOADED [...]" */ +void hs_control_desc_event_uploaded(const hs_ident_dir_conn_t *ident, + const char *hsdir_id_digest); + #endif /* !defined(TOR_HS_CONTROL_H) */