summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2013-09-04 19:43:46 -0400
committerRoger Dingledine <arma@torproject.org>2013-09-04 23:21:46 -0400
commitc6f1668db3010de6aed22bd87850aa846911d43b (patch)
treeb7d4d37cb22cec0da37fd654863407e4205d8348
parent71e0ca02b57f7945d922a8708a2c97815a9350ad (diff)
downloadtor-c6f1668db3010de6aed22bd87850aa846911d43b.tar.gz
tor-c6f1668db3010de6aed22bd87850aa846911d43b.zip
nickm wants us to prioritize tap in a currently-rare edge case
-rw-r--r--src/or/onion.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/or/onion.c b/src/or/onion.c
index cabd05559b..41fe7b6eea 100644
--- a/src/or/onion.c
+++ b/src/or/onion.c
@@ -217,8 +217,21 @@ decide_next_handshake_type(void)
if (!ol_entries[ONION_HANDSHAKE_TYPE_NTOR])
return ONION_HANDSHAKE_TYPE_TAP; /* no ntors? try tap */
- if (!ol_entries[ONION_HANDSHAKE_TYPE_TAP])
+ if (!ol_entries[ONION_HANDSHAKE_TYPE_TAP]) {
+
+ /* Nick wants us to prioritize new tap requests when there aren't
+ * any in the queue and we've processed k ntor cells since the last
+ * tap cell. This strategy is maybe a good idea, since it starves tap
+ * less in the case where tap is rare, or maybe a poor idea, since it
+ * makes the new tap cell unfairly jump in front of ntor cells that
+ * got here first. In any case this edge case will only become relevant
+ * once tap is rare. We should reevaluate whether we like this decision
+ * once tap gets more rare. */
+ if (ol_entries[ONION_HANDSHAKE_TYPE_NTOR])
+ ++recently_chosen_ntors;
+
return ONION_HANDSHAKE_TYPE_NTOR; /* no taps? try ntor */
+ }
/* They both have something queued. Pick ntor if we haven't done that
* too much lately. */