diff options
-rw-r--r-- | src/or/directory.c | 20 | ||||
-rw-r--r-- | src/or/or.h | 1 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/or/directory.c b/src/or/directory.c index 0cefb9641..24b3b1c66 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -83,6 +83,19 @@ purpose_is_private(uint8_t purpose) return 1; } +/** Return a static string describing <b>auth</b>. */ +const char * +authority_type_to_string(authority_type_t auth) +{ + switch(auth) { + case V1_AUTHORITY: return "V1"; + case V2_AUTHORITY: return "V2"; + case BRIDGE_AUTHORITY: return "Bridge"; + case HIDSERV_AUTHORITY: return "Hidden service"; + case NO_AUTHORITY: default: return "[Unexpected authority type]"; + } +} + /** Start a connection to every suitable directory server, using * connection purpose 'purpose' and uploading the payload 'payload' * (length 'payload_len'). The purpose should be one of @@ -100,6 +113,7 @@ directory_post_to_dirservers(uint8_t purpose, authority_type_t type, { int post_via_tor; smartlist_t *dirservers = router_get_trusted_dir_servers(); + int found = 0; tor_assert(dirservers); /* This tries dirservers which we believe to be down, but ultimately, that's * harmless, and we may as well err on the side of getting things uploaded. @@ -120,6 +134,7 @@ directory_post_to_dirservers(uint8_t purpose, authority_type_t type, continue; if (type == V2_AUTHORITY && !ds->is_v2_authority) continue; + found = 1; /* at least one authority of this type was listed */ if (purpose == DIR_PURPOSE_UPLOAD_DIR) ds->has_accepted_serverdesc = 0; @@ -136,6 +151,11 @@ directory_post_to_dirservers(uint8_t purpose, authority_type_t type, directory_initiate_command_routerstatus(rs, purpose, post_via_tor, NULL, payload, upload_len); }); + if (!found) { + log_warn(LD_DIR, "Publishing server descriptor to directory authorities " + "of type '%s', but no authorities of that type listed!", + authority_type_to_string(type)); + } } /** Start a connection to a random running directory server, using diff --git a/src/or/or.h b/src/or/or.h index d1a3cab2f..a881f89f9 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -2519,6 +2519,7 @@ int assign_to_cpuworker(connection_t *cpuworker, uint8_t question_type, /********************************* directory.c ***************************/ +const char *authority_type_to_string(authority_type_t auth); void directory_post_to_dirservers(uint8_t purpose, authority_type_t type, const char *payload, size_t payload_len, size_t extrainfo_len); |