aboutsummaryrefslogtreecommitdiff
path: root/src/or/directory.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/directory.c')
-rw-r--r--src/or/directory.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index 961e33424b..6f271b2b1f 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -2297,10 +2297,8 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
{
rend_cache_entry_t *entry = NULL;
- switch (rend_cache_store_v2_desc_as_client(body,
- conn->requested_resource, conn->rend_data,
- &entry)) {
- case RCS_BADDESC:
+ if (rend_cache_store_v2_desc_as_client(body,
+ conn->requested_resource, conn->rend_data, &entry) < 0) {
log_warn(LD_REND,"Fetching v2 rendezvous descriptor failed. "
"Retrying at another directory.");
/* We'll retry when connection_about_to_close_connection()
@@ -2308,11 +2306,9 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
SEND_HS_DESC_FAILED_EVENT("BAD_DESC");
SEND_HS_DESC_FAILED_CONTENT();
break;
- case RCS_OKAY:
- default:
- {
+ } else {
char service_id[REND_SERVICE_ID_LEN_BASE32 + 1];
- /* Should never be NULL here for an OKAY returned code. */
+ /* Should never be NULL here if we found the descriptor. */
tor_assert(entry);
rend_get_service_id(entry->parsed->pk, service_id);
@@ -2330,7 +2326,6 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
rend_client_desc_trynow(service_id);
memwipe(service_id, 0, sizeof(service_id));
break;
- }
}
break;
}
@@ -3426,15 +3421,12 @@ directory_handle_command_post(dir_connection_t *conn, const char *headers,
/* Handle v2 rendezvous service publish request. */
if (connection_dir_is_encrypted(conn) &&
!strcmpstart(url,"/tor/rendezvous2/publish")) {
- switch (rend_cache_store_v2_desc_as_dir(body)) {
- case RCS_BADDESC:
+ if (rend_cache_store_v2_desc_as_dir(body) < 0) {
log_warn(LD_REND, "Rejected v2 rend descriptor (length %d) from %s.",
(int)body_len, conn->base_.address);
write_http_status_line(conn, 400,
"Invalid v2 service descriptor rejected");
- break;
- case RCS_OKAY:
- default:
+ } else {
write_http_status_line(conn, 200, "Service descriptor (v2) stored");
log_info(LD_REND, "Handled v2 rendezvous descriptor post: accepted");
}