diff options
author | David Goulet <dgoulet@torproject.org> | 2017-11-10 14:12:34 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-12-05 19:39:46 -0500 |
commit | 3b436d495fc6ad59ff5d9406d7ef17494286c299 (patch) | |
tree | a0238ed65588572666ff9badd541e30f2d22cfd8 /src/or/control.c | |
parent | 8365de1da3de53fc02d463d78187625d16a5180b (diff) | |
download | tor-3b436d495fc6ad59ff5d9406d7ef17494286c299.tar.gz tor-3b436d495fc6ad59ff5d9406d7ef17494286c299.zip |
hs-v3: Implement HS_DESC RECEIVED event
Adds a v3 specific function to handle a received event.
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/control.c')
-rw-r--r-- | src/or/control.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/or/control.c b/src/or/control.c index 3ba3a4b3a0..a1515da05a 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -7398,6 +7398,29 @@ control_event_hsv2_descriptor_received(const char *onion_address, tor_free(desc_id_field); } +/* Send HS_DESC RECEIVED event + * + * Called when we successfully received a hidden service descriptor. */ +void +control_event_hsv3_descriptor_received(const char *onion_address, + const char *desc_id, + const char *hsdir_id_digest) +{ + char *desc_id_field = NULL; + + if (BUG(!onion_address || !desc_id || !hsdir_id_digest)) { + return; + } + + /* Because DescriptorID is an optional positional value, we need to add a + * whitespace before in order to not be next to the HsDir value. */ + tor_asprintf(&desc_id_field, " %s", desc_id); + + event_hs_descriptor_receive_end("RECEIVED", onion_address, desc_id_field, + REND_NO_AUTH, hsdir_id_digest, NULL); + tor_free(desc_id_field); +} + /** send HS_DESC UPLOADED event * * called when we successfully uploaded a hidden service descriptor. |