summaryrefslogtreecommitdiff
path: root/src/or/control.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/control.c')
-rw-r--r--src/or/control.c55
1 files changed, 36 insertions, 19 deletions
diff --git a/src/or/control.c b/src/or/control.c
index c65f7bd123..05ff9a6592 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -4982,6 +4982,21 @@ rend_auth_type_to_string(rend_auth_type_t auth_type)
return str;
}
+/** Return a longname the node whose identity is <b>id_digest</b>. If
+ * node_get_by_id() returns NULL, base 16 encoding of <b>id_digest</b> is
+ * returned instead.
+ *
+ * This function is not thread-safe. Each call to this function invalidates
+ * previous values returned by this function.
+ */
+MOCK_IMPL(const char *,
+node_describe_longname_by_id,(const char *id_digest))
+{
+ static char longname[MAX_VERBOSE_NICKNAME_LEN+1];
+ node_get_verbose_nickname_by_id(id_digest, longname);
+ return longname;
+}
+
/** send HS_DESC requested event.
*
* <b>rend_query</b> is used to fetch requested onion address and auth type.
@@ -4990,20 +5005,21 @@ rend_auth_type_to_string(rend_auth_type_t auth_type)
*/
void
control_event_hs_descriptor_requested(const rend_data_t *rend_query,
- const char *hs_dir,
+ const char *id_digest,
const char *desc_id_base32)
{
- if (!hs_dir || !rend_query || !desc_id_base32) {
+ if (!id_digest || !rend_query || !desc_id_base32) {
log_warn(LD_BUG, "Called with rend_query==%p, "
- "hs_dir==%p, desc_id_base32==%p",
- rend_query, hs_dir, desc_id_base32);
+ "id_digest==%p, desc_id_base32==%p",
+ rend_query, id_digest, desc_id_base32);
return;
}
+
send_control_event(EVENT_HS_DESC, ALL_FORMATS,
"650 HS_DESC REQUESTED %s %s %s %s\r\n",
rend_query->onion_address,
rend_auth_type_to_string(rend_query->auth_type),
- hs_dir,
+ node_describe_longname_by_id(id_digest),
desc_id_base32);
}
@@ -5018,19 +5034,20 @@ control_event_hs_descriptor_requested(const rend_data_t *rend_query,
void
control_event_hs_descriptor_receive_end(const char *action,
const rend_data_t *rend_query,
- const char *hs_dir)
+ const char *id_digest)
{
- if (!action || !rend_query || !hs_dir) {
+ if (!action || !rend_query || !id_digest) {
log_warn(LD_BUG, "Called with action==%p, rend_query==%p, "
- "hs_dir==%p", action, rend_query, hs_dir);
+ "id_digest==%p", action, rend_query, id_digest);
return;
}
+
send_control_event(EVENT_HS_DESC, ALL_FORMATS,
"650 HS_DESC %s %s %s %s\r\n",
action,
rend_query->onion_address,
rend_auth_type_to_string(rend_query->auth_type),
- hs_dir);
+ node_describe_longname_by_id(id_digest));
}
/** send HS_DESC RECEIVED event
@@ -5039,14 +5056,14 @@ control_event_hs_descriptor_receive_end(const char *action,
*/
void
control_event_hs_descriptor_received(const rend_data_t *rend_query,
- const char *hs_dir)
+ const char *id_digest)
{
- if (!rend_query || !hs_dir) {
- log_warn(LD_BUG, "Called with rend_query==%p, hs_dir==%p",
- rend_query, hs_dir);
+ if (!rend_query || !id_digest) {
+ log_warn(LD_BUG, "Called with rend_query==%p, id_digest==%p",
+ rend_query, id_digest);
return;
}
- control_event_hs_descriptor_receive_end("RECEIVED", rend_query, hs_dir);
+ control_event_hs_descriptor_receive_end("RECEIVED", rend_query, id_digest);
}
/** send HS_DESC FAILED event
@@ -5055,14 +5072,14 @@ control_event_hs_descriptor_received(const rend_data_t *rend_query,
*/
void
control_event_hs_descriptor_failed(const rend_data_t *rend_query,
- const char *hs_dir)
+ const char *id_digest)
{
- if (!rend_query || !hs_dir) {
- log_warn(LD_BUG, "Called with rend_query==%p, hs_dir==%p",
- rend_query, hs_dir);
+ if (!rend_query || !id_digest) {
+ log_warn(LD_BUG, "Called with rend_query==%p, id_digest==%p",
+ rend_query, id_digest);
return;
}
- control_event_hs_descriptor_receive_end("FAILED", rend_query, hs_dir);
+ control_event_hs_descriptor_receive_end("FAILED", rend_query, id_digest);
}
/** Free any leftover allocated memory of the control.c subsystem. */