Improve code based on Nick review:

- Fix some more crazy ternary ops.
- Fix the order of disaster SRV computation.
- Whitespace fixes.
- Remove a redundant warn.
- Better docs.
This commit is contained in:
George Kadianakis 2017-08-04 22:02:28 +03:00 committed by Nick Mathewson
parent 4ad4467fa1
commit c62da5cf95
5 changed files with 10 additions and 8 deletions

View File

@ -699,8 +699,11 @@ hs_circ_retry_service_rendezvous_point(origin_circuit_t *circ)
circ->hs_service_side_rend_circ_has_been_relaunched = 1;
/* Legacy service don't have an hidden service ident. */
(circ->hs_ident) ? retry_service_rendezvous_point(circ) :
rend_service_relaunch_rendezvous(circ);
if (circ->hs_ident) {
retry_service_rendezvous_point(circ);
} else {
rend_service_relaunch_rendezvous(circ);
}
done:
return;

View File

@ -521,9 +521,9 @@ get_disaster_srv(uint64_t time_period_num, uint8_t *srv_out)
uint64_t time_period_length = get_time_period_length();
char period_stuff[sizeof(uint64_t)*2];
size_t offset = 0;
set_uint64(period_stuff, tor_htonll(time_period_num));
set_uint64(period_stuff, tor_htonll(time_period_length));
offset += sizeof(uint64_t);
set_uint64(period_stuff+offset, tor_htonll(time_period_length));
set_uint64(period_stuff+offset, tor_htonll(time_period_num));
offset += sizeof(uint64_t);
tor_assert(offset == sizeof(period_stuff));

View File

@ -1007,7 +1007,6 @@ desc_encode_v3(const hs_descriptor_t *desc,
tor_assert(desc->plaintext_data.version == 3);
if (BUG(desc->subcredential == NULL)) {
log_warn(LD_GENERAL, "Asked to encode desc with no subcred. No!");
goto err;
}

View File

@ -2881,14 +2881,14 @@ hs_service_circuit_has_opened(origin_circuit_t *circ)
if (circ->hs_ident) {
service_intro_circ_has_opened(circ);
} else {
rend_service_intro_has_opened(circ);
rend_service_intro_has_opened(circ);
}
break;
case CIRCUIT_PURPOSE_S_CONNECT_REND:
if (circ->hs_ident) {
service_rendezvous_circ_has_opened(circ);
} else {
rend_service_rendezvous_has_opened(circ);
rend_service_rendezvous_has_opened(circ);
}
break;
default:

View File

@ -1400,7 +1400,7 @@ networkstatus_get_live_consensus,(time_t now))
return NULL;
}
/** Given a consensus in <b>ns</b>, validate that it's currently live and
/** Given a consensus in <b>ns</b>, return true iff currently live and
* unexpired. */
int
networkstatus_is_live(const networkstatus_t *ns, time_t now)