aboutsummaryrefslogtreecommitdiff
path: root/src/core/mainloop
diff options
context:
space:
mode:
authorteor <teor@torproject.org>2020-02-14 10:13:00 +1000
committerteor <teor@torproject.org>2020-02-14 10:13:00 +1000
commit98899f20ad22e97c03235cfe13ff1fe416a15509 (patch)
tree6a3575a85e1c4ef8c46d4afa8740a6ae23292224 /src/core/mainloop
parent1ab7c052317943ea43bf99b4032a7cb19f373f5c (diff)
downloadtor-98899f20ad22e97c03235cfe13ff1fe416a15509.tar.gz
tor-98899f20ad22e97c03235cfe13ff1fe416a15509.zip
mainloop: Explain local connections better
Some connections aren't counted for statistics or accounting, because they have been specifically configured by the user to local addresses. Comment-only change. Closes 33201.
Diffstat (limited to 'src/core/mainloop')
-rw-r--r--src/core/mainloop/connection.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/core/mainloop/connection.c b/src/core/mainloop/connection.c
index 4a2dc21f1c..48f31922d7 100644
--- a/src/core/mainloop/connection.c
+++ b/src/core/mainloop/connection.c
@@ -3345,8 +3345,17 @@ record_num_bytes_transferred_impl(connection_t *conn,
rep_hist_note_dir_bytes_written(num_written, now);
}
+ /* Linked connections and internal IPs aren't counted for statistics or
+ * accounting:
+ * - counting linked connections would double-count BEGINDIR bytes, because
+ * they are sent as Dir bytes on the linked connection, and OR bytes on
+ * the OR connection;
+ * - relays and clients don't connect to internal IPs, unless specifically
+ * configured to do so. If they are configured that way, we don't count
+ * internal bytes.
+ */
if (!connection_is_rate_limited(conn))
- return; /* local IPs are free */
+ return;
if (conn->type == CONN_TYPE_OR)
rep_hist_note_or_conn_bytes(conn->global_identifier, num_read,