aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2017-08-04 22:02:28 +0300
committerNick Mathewson <nickm@torproject.org>2017-08-08 20:29:34 -0400
commitc62da5cf95de0958d28d2dfd8cdc66cf11498ebe (patch)
tree22ee0284768e83db9055da7f38f7be7eb1877dec
parent4ad4467fa13a0e6333fa0016a63060d5b9dd9715 (diff)
downloadtor-c62da5cf95de0958d28d2dfd8cdc66cf11498ebe.tar.gz
tor-c62da5cf95de0958d28d2dfd8cdc66cf11498ebe.zip
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.
-rw-r--r--src/or/hs_circuit.c7
-rw-r--r--src/or/hs_common.c4
-rw-r--r--src/or/hs_descriptor.c1
-rw-r--r--src/or/hs_service.c4
-rw-r--r--src/or/networkstatus.c2
5 files changed, 10 insertions, 8 deletions
diff --git a/src/or/hs_circuit.c b/src/or/hs_circuit.c
index 527439599a..faceb731c5 100644
--- a/src/or/hs_circuit.c
+++ b/src/or/hs_circuit.c
@@ -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;
diff --git a/src/or/hs_common.c b/src/or/hs_common.c
index a29b377494..f5c63cb6a0 100644
--- a/src/or/hs_common.c
+++ b/src/or/hs_common.c
@@ -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));
diff --git a/src/or/hs_descriptor.c b/src/or/hs_descriptor.c
index 430e2f6f99..0b10f205a5 100644
--- a/src/or/hs_descriptor.c
+++ b/src/or/hs_descriptor.c
@@ -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;
}
diff --git a/src/or/hs_service.c b/src/or/hs_service.c
index f1592efa81..bea760837b 100644
--- a/src/or/hs_service.c
+++ b/src/or/hs_service.c
@@ -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:
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index 82ceb8a9eb..69bff55cff 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -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)