[or-cvs] r9882: a stopgap measure while we wait for proposal 111: apply the (tor/trunk/src/or)

arma at seul.org arma at seul.org
Tue Mar 20 03:21:54 UTC 2007


Author: arma
Date: 2007-03-19 23:21:51 -0400 (Mon, 19 Mar 2007)
New Revision: 9882

Modified:
   tor/trunk/src/or/connection.c
   tor/trunk/src/or/connection_edge.c
   tor/trunk/src/or/or.h
Log:
a stopgap measure while we wait for proposal 111: apply the
stricter rate limiting to all OR conns except those that have
been touched by local circuits.


Modified: tor/trunk/src/or/connection.c
===================================================================
--- tor/trunk/src/or/connection.c	2007-03-20 02:55:31 UTC (rev 9881)
+++ tor/trunk/src/or/connection.c	2007-03-20 03:21:51 UTC (rev 9882)
@@ -1119,10 +1119,8 @@
 static int
 connection_counts_as_relayed_traffic(connection_t *conn)
 {
-#if 0
-  if (conn->type == CONN_TYPE_OR && TO_OR_CONN(conn)->bandwidth_class)
+  if (conn->type == CONN_TYPE_OR && !TO_OR_CONN(conn)->client_used)
     return 1;
-#endif
   if (conn->type == CONN_TYPE_DIR && DIR_CONN_IS_SERVER(conn))
     return 1;
   return 0;

Modified: tor/trunk/src/or/connection_edge.c
===================================================================
--- tor/trunk/src/or/connection_edge.c	2007-03-20 02:55:31 UTC (rev 9881)
+++ tor/trunk/src/or/connection_edge.c	2007-03-20 03:21:51 UTC (rev 9882)
@@ -1792,6 +1792,11 @@
   log_info(LD_APP,"Address/port sent, ap socket %d, n_circ_id %d",
            ap_conn->_base.s, circ->_base.n_circ_id);
   control_event_stream_status(ap_conn, STREAM_EVENT_SENT_CONNECT, 0);
+
+  if ((TO_CIRCUIT(circ))->n_conn) {
+    /* mark it so it gets better rate limiting treatment. */
+    (TO_CIRCUIT(circ))->n_conn->client_used = 1;
+  }
   return 0;
 }
 

Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h	2007-03-20 02:55:31 UTC (rev 9881)
+++ tor/trunk/src/or/or.h	2007-03-20 03:21:51 UTC (rev 9882)
@@ -790,8 +790,11 @@
   char identity_digest[DIGEST_LEN];
   char *nickname; /**< Nickname of OR on other side (if any). */
 
-  tor_tls_t *tls; /**< TLS connection state */
-  int tls_error; /**< Last tor_tls error code */
+  tor_tls_t *tls; /**< TLS connection state. */
+  int tls_error; /**< Last tor_tls error code. */
+  /** Whether we are using this conn for any client traffic. If we're
+   * not, we can rate limit it further. */
+  uint8_t client_used:1;
 
   time_t timestamp_lastempty; /**< When was the outbuf last completely empty?*/
 



More information about the tor-commits mailing list