]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
a stopgap measure while we wait for proposal 111: apply the
authorRoger Dingledine <arma@torproject.org>
Tue, 20 Mar 2007 03:21:51 +0000 (03:21 +0000)
committerRoger Dingledine <arma@torproject.org>
Tue, 20 Mar 2007 03:21:51 +0000 (03:21 +0000)
stricter rate limiting to all OR conns except those that have
been touched by local circuits.

svn:r9882

src/or/connection.c
src/or/connection_edge.c
src/or/or.h

index 41104ba11de076029ec72f831e0e4fa720c0dfa0..458e39e30063982ed0d1188abafb87e56a32492b 100644 (file)
@@ -1119,10 +1119,8 @@ static int write_buckets_empty_last_second = 0;
 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;
index beb1caeea6b2b1c54848a7722e23f805d6b9cbbd..44c3197b5c3f274550ad84e17d5c7e61bfdcb242 100644 (file)
@@ -1792,6 +1792,11 @@ connection_ap_handshake_send_begin(edge_connection_t *ap_conn,
   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;
 }
 
index 3f76ceaaa6c7a4bcf467fa335484b6e1b0769aec..62a3442c77543101305564bb689757736d9fa6bf 100644 (file)
@@ -790,8 +790,11 @@ typedef struct or_connection_t {
   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?*/