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

[tor-commits] [tor] 03/07: Clean up UX decision logic; hardcode for browser UX case.



This is an automated email from the git hooks/post-receive script.

dgoulet pushed a commit to branch main
in repository tor.

commit a340acb492e216e74334f4ff00dbbe5abc6ec956
Author: Mike Perry <mikeperry-git@xxxxxxxxxxxxxx>
AuthorDate: Tue May 9 20:11:41 2023 +0000

    Clean up UX decision logic; hardcode for browser UX case.
---
 src/core/or/conflux_cell.c | 15 +++------------
 src/core/or/conflux_cell.h |  2 +-
 src/core/or/conflux_pool.c | 20 ++++++++++++--------
 3 files changed, 16 insertions(+), 21 deletions(-)

diff --git a/src/core/or/conflux_cell.c b/src/core/or/conflux_cell.c
index fa0bb1c23e..a59fa735f1 100644
--- a/src/core/or/conflux_cell.c
+++ b/src/core/or/conflux_cell.c
@@ -266,22 +266,13 @@ conflux_cell_parse_linked(const cell_t *cell, const uint16_t cell_len)
 
 conflux_cell_link_t *
 conflux_cell_new_link(const uint8_t *nonce, uint64_t last_seqno_sent,
-                      uint64_t last_seqno_recv, bool is_client)
+                      uint64_t last_seqno_recv, uint8_t ux)
 {
   conflux_cell_link_t *link = tor_malloc_zero(sizeof(*link));
 
   link->version = 0x01;
-  if (is_client) {
-    // TODO-329-TUNING: The default should probably be high-throughput,
-    // but mobile clients may want to use low-memory.. We may also want
-    // to move this choice upstairs, so that torrc can control it.
-    link->desired_ux = CONFLUX_UX_HIGH_THROUGHPUT;
-  } else {
-    // TODO-329-TUNING: For exits, the default should be min-latency
-    // but we need to fix the tests and evaluate this first.
-    //link->desired_ux = CONFLUX_UX_MIN_LATENCY;
-    link->desired_ux = CONFLUX_UX_HIGH_THROUGHPUT;
-  }
+  link->desired_ux = ux;
+
   link->last_seqno_sent = last_seqno_sent;
   link->last_seqno_recv = last_seqno_recv;
   memcpy(link->nonce, nonce, sizeof(link->nonce));
diff --git a/src/core/or/conflux_cell.h b/src/core/or/conflux_cell.h
index afaecae6f5..60fff42241 100644
--- a/src/core/or/conflux_cell.h
+++ b/src/core/or/conflux_cell.h
@@ -23,7 +23,7 @@ typedef struct conflux_cell_link_t {
 conflux_cell_link_t *conflux_cell_new_link(const uint8_t *nonce,
                                            uint64_t last_sent,
                                            uint64_t last_recv,
-                                           bool is_client);
+                                           uint8_t ux);
 
 conflux_cell_link_t *conflux_cell_parse_link(const cell_t *cell,
                                              const uint16_t cell_len);
diff --git a/src/core/or/conflux_pool.c b/src/core/or/conflux_pool.c
index ae14bd1b3c..02d511149c 100644
--- a/src/core/or/conflux_pool.c
+++ b/src/core/or/conflux_pool.c
@@ -143,18 +143,19 @@ fmt_nonce(const uint8_t *nonce)
 static uint8_t
 conflux_choose_algorithm(uint8_t desired_ux)
 {
-  /* TODO-329-TUNING: Pick better algs here*/
   switch (desired_ux) {
     case CONFLUX_UX_NO_OPINION:
       return CONFLUX_ALG_LOWRTT;
     case CONFLUX_UX_MIN_LATENCY:
       return CONFLUX_ALG_MINRTT;
-    case CONFLUX_UX_LOW_MEM_LATENCY:
-      return CONFLUX_ALG_MINRTT;
-    case CONFLUX_UX_LOW_MEM_THROUGHPUT:
-      return CONFLUX_ALG_CWNDRTT;
     case CONFLUX_UX_HIGH_THROUGHPUT:
       return CONFLUX_ALG_LOWRTT;
+    /* For now, we have no low mem algs, so use minRTT since it should
+     * switch less and thus use less mem */
+    /* TODO-329-TUNING: Pick better algs here*/
+    case CONFLUX_UX_LOW_MEM_THROUGHPUT:
+    case CONFLUX_UX_LOW_MEM_LATENCY:
+      return CONFLUX_ALG_MINRTT;
     default:
       /* Trunnel should protect us from this */
       tor_assert_nonfatal_unreached();
@@ -1105,11 +1106,12 @@ conflux_launch_leg(const uint8_t *nonce)
   // arti-relay could (if resumption seems worthwhile; it may not be worth the
   // memory storage there, either).
 
-  /* We have a circuit, create the new leg and attach it to the set. */
+  /* We have a circuit, create the new leg and attach it to the set.
+   * TODO-329-TUNING: Should we make a torrc option to request min latency? */
   leg_t *leg = leg_new(TO_CIRCUIT(circ),
                        conflux_cell_new_link(nonce,
                                              last_seq_sent, last_seq_recv,
-                                             true));
+                                             CONFLUX_UX_HIGH_THROUGHPUT));
 
   /* Increase the retry count for this conflux object as in this nonce. */
   unlinked->cfx->num_leg_launch++;
@@ -1760,8 +1762,10 @@ conflux_process_link(circuit_t *circ, const cell_t *cell,
     goto end;
   }
 
+  /* Exits should always request min latency from clients */
   conflux_cell_link_t *linked = conflux_cell_new_link(nonce, last_seq_sent,
-                                                      last_seq_recv, false);
+                                                      last_seq_recv,
+                                                      CONFLUX_UX_MIN_LATENCY);
 
   conflux_cell_send_linked(linked, TO_OR_CIRCUIT(circ));
   tor_free(linked);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits