[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Improve code based on Nick review:



commit c62da5cf95de0958d28d2dfd8cdc66cf11498ebe
Author: George Kadianakis <desnacked@xxxxxxxxxx>
Date:   Fri Aug 4 22:02:28 2017 +0300

    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.
---
 src/or/hs_circuit.c    | 7 +++++--
 src/or/hs_common.c     | 4 ++--
 src/or/hs_descriptor.c | 1 -
 src/or/hs_service.c    | 4 ++--
 src/or/networkstatus.c | 2 +-
 5 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/or/hs_circuit.c b/src/or/hs_circuit.c
index 527439599..faceb731c 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 a29b37749..f5c63cb6a 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 430e2f6f9..0b10f205a 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 f1592efa8..bea760837 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 82ceb8a9e..69bff55cf 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)



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits